[英]My div background image doesn't shown
I assigned a background image for a <div>
in the CSS of my HTML code, i assigned the width and height and also add contents to the <div>
but the bg still not shown, this is what I've tried: 我在HTML代码的CSS中为
<div>
分配了背景图片,分配了宽度和高度,还向<div>
添加了内容,但是bg仍未显示,这是我尝试的方法:
CSS: CSS:
#order_list {
position: absolute;
width: 25%;
height: 100%;
z-index: 2;
left: 75%;
top: 35px;
color: #F33;
background:url(img/ItemList.png)
display: inline-block;
alignment-adjust: central;
font: Arial, Helvetica, sans-serif;
font-size: 14px;
font-size-adjust: inherit;
grid-rows: inherit;
list-style: upper-alpha;
word-spacing: inherit;
word-wrap: break-word;
vertical-align: central;
}
HTML: HTML:
<div id="order_list">
<div id="confirm" class="buttonClass">
<div align="center">Confirm</div>
</div>
<div id="total" class="totalClass">
<div align="center"></div>
</div>
</div>
screen shot: 屏幕截图:
It might depend on how your browser interprets it, but you forgot a semicolon at the end of background:url(img/ItemList.png)
它可能取决于您的浏览器如何解释它,但您在
background:url(img/ItemList.png)
的末尾忘记了一个分号background:url(img/ItemList.png)
Without it, browsers won't show the image. 没有它,浏览器将不会显示图像。 Thanks to @Leeish for noting that in this case, a semicolon is absolutely neccessary.
感谢@Leeish注意到在这种情况下,分号是绝对必要的。
;
is missing at the end of background:url(img/ItemList.png)
which is why you are not getting the background image. 在
background:url(img/ItemList.png)
的末尾缺少background:url(img/ItemList.png)
这就是你没有得到背景图片的原因。
Semicolon is needed to separate the declarations from one another. 需要使用分号将声明彼此分开。 It can be omitted from the last declaration in a CSS rule, but it is recommended so that later if you want to add more declarations, you won't need to remember to add it in there.
它可以从CSS规则中的最后一个声明中省略,但建议以后如果要添加更多声明,则不需要记住将其添加到那里。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.