background-image
不适用于百分比div大小吗?如果我在.contrast
类中硬编码width
和height
,图像才会显示出来。如果宽度和高度都是百分比,则图像不显示。任何见解?DIV的CSS背景图像不适用于汽车
CSS:
.parent{
width=1000px;
}
img.contrast{
width:400px;
height:100px;
background-image: url(http://www.jpl.nasa.gov/spaceimages/images/mediumsize/PIA17011_ip.jpg);
}
HTML:
<div class="parent">
<img class="contrast"/>
<img class="contrast"/>
<img class="contrast"/>
</div>
EDIT1:所以.contrast
不能继承父组的长度?如果我在父分区中设置了3个分区,宽度设置为25%,则无法访问父分区的宽度?
错字:1000像素; –