定义一个< IMG>在CSS的src属性 [英] Define an <img>'s src attribute in CSS

查看:156
本文介绍了定义一个< IMG>在CSS的src属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要定义一个< IMG>的SRC的CSS属性。有没有指定这个属性的方法?


解决方案

  #divID {
背景图像:网址(http://imageurlhere.com);
背景重复:不重复;
宽度:汽车; / *或图像的宽度* /
身高:汽车; / *或图像高度* /
保证金:0;
填充:0;
}

I need to define an <img>'s src attribute in CSS. Is there a way to specify this attribute?

解决方案

#divID {
background-image: url("http://imageurlhere.com");
background-repeat: no-repeat;
width: auto; /*or your image's width*/
height: auto; /*or your image's height*/
margin: 0;
padding: 0;
}

这篇关于定义一个&LT; IMG&gt;在CSS的src属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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