Background-Image in< img>元件 [英] Background-Image in <img> element

查看:130
本文介绍了Background-Image in< img>元件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以帮我找到我的问题吗?
我有一个< img /> ,并且会给他一个< a> 标签。



以下是我的示例:

  ; img border =0style =display:block; width:20px; height:20px; background-color:red; padding:9px; background:url(\'./ images / system / button / close / close .png)\'no-repeat/> 

背景颜色没有工作到.. :-(我的示例是一个JavaScript字符串,

解决方案



  background:url(./ images / system / button / close /close.png)

使用div如果可以

 < div style =height:20px; width:20px; padding:9px; background:url(./ images / system / button / close / close.png) no-repeat red>< / div> 


Can someone help me to find my Problem ? I have a <img /> and will give him a background-image within a <a> tag.

Here is my example:

<img border="0" style="display:block; width:20px; height:20px; background-color:red; padding:9px; background:url(\'./images/system/button/close/close.png)\' no-repeat" />

Background-Color didn't work to.. :-( My Example is a JavaScript String, thats the reason why I'm escaping the URL

Thank's for help :-)

解决方案

you dont even need the quote marks.

background:url(./images/system/button/close/close.png)

use a div if you can

<div style="height:20px; width:20px; padding:9px; background:url(./images/system/button/close/close.png) no-repeat red"></div>

这篇关于Background-Image in&lt; img&gt;元件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆