我有一个 CSS 背景图像无法显示的问题,谁能知道为什么它无法显示图像?我自己也想不通。
<!-- Section: services -->
<section id="service" class="home-section text-center bg-gray">
<div class="heading-about">
<div class="container">
<div class="row">
<div class="col-lg-8 col-lg-offset-2">
<div class="wow bounceInDown" data-wow-delay="0.4s">
<div class="section-heading">
<h2>SCHEMA!</h2>
<i class="fa fa-2x fa-angle-down"></i>
</div>
</div>
</div>
</div>
</div>
</div>
<br>TEST<br>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- /Section: services -->
.service {
width:100%;
position:relative;
background: url(../img/bg2.jpg) no-repeat top center;
}
最佳答案
你想在引用元素的 ID 时使用#service。
#service {
width:100%;
position:relative;
background: url(../img/bg2.jpg) no-repeat top center;
}
关于 css 选择器的一个很好的指南可以找到 here .
关于html - CSS 背景图像不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28550573/