简体   繁体   English

Css - background-img url no-repeat center center不工作

[英]Css - background-img url no-repeat center center Not working

i using bootstrap in my website but just i get one problem 我在我的网站上使用bootstrap,但我遇到了一个问题

-HTML -HTML

 <div class="first-background">
        ----- skip 
 </div>

 <div class="second-background">
        ----- skip
 </div>

-CSS -CSS

.first-background{
  padding-top: 100px;
  width: 100%;
  background-color: #E8ECEE;    
}

.second-background{
  background-image: url(../img/background.png);

  -- first ways
  background-repeat:no-repeat;
  background-size: cover;

  -- second ways
  background-repeat: no-repeat;
  background-position: center center;

  -- third ways 
  background-image: url(../img/background.png) no-repeat center center fixed;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  background-size: cover;
  -o-background-size: cover;

} }

i tried anyways but cover or center center Not Working in my webSite 无论如何我试过但是我的网站不能覆盖或居中

how to solve this problem? 如何解决这个问题呢? now i don't have any solution. 现在我没有任何解决方案。

For starters, your syntax for the 2nd div is incorrect. 对于初学者,第二个div的语法不正确。 Specifically, you spelled 'class' wrong. 具体来说,你拼错了“阶级”。 Usually stack overflow does not take kindly to these types of issues, so make sure the code you post is almost the EXACT code (minus raw data) into the question. 通常,堆栈溢出不会对这些类型的问题产生好感,因此请确保您发布的代码几乎是完整的代码(减去原始数据)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM