【问题标题】:Margin is white. How to change it back to the background color?边距为白色。如何将其更改回背景颜色?
【发布时间】:2016-09-24 08:27:51
【问题描述】:

Here is a picture of what I want changed to blue

这是我的 html 和 css 代码:https://jsbin.com/cofeweqaca/edit?html,css,output

好吧,奇怪的事情发生了。当我创建 jsbin 来向您展示我的所有问题时,问题并不存在。所以我的问题以某种方式存在于崇高之中。我的问题是:2个灰色div之间的空间(顶部是jumbotron,底部不是)。应该是蓝色的,就像在 jsbin 中一样。但是在我的崇高中,当我在 Chrome 中打开它时,它是白色的。除了两个 div 之间的小条纹外,其他所有内容都是蓝色的。 我对 Web 开发人员场景非常陌生。所以也许比我更聪明的人可以解释这个问题的原因?为什么是白色的?谢谢!

编辑:这是我的直接代码。

html {
  font-family: 'Droid Sans', sans-serif;
}
#navb {
  background: #3E474C;
}
#bs-example-navbar-collapse-1 ul li a {
  color: white;
}
li:hover {} html {
  background: #A5BCCC;
}
body {
  background: #A5BCCC;
}
#rankjumbo {
  margin-top: 100px;
  height: 350px;
  margin-bottom: 0;
}
.searchbox {
  width: 50%;
  margin: auto auto;
}
#text {
  text-align: center;
  font-family: 'Droid Sans', sans-serif;
}
#h1 {
  font-family: 'Pacifico', cursive;
  text-align: center;
  padding-bottom: 30px;
}
#button {
  background: #4B7795;
  color: white;
  font-family: 'Droid Sans', sans-serif;
}
.list {
  height: 300px;
  background: #eee;
  margin-top: 30px;
}
<div id="rankjumbo" class="jumbotron">

  <div class="container">

    <div id="special">

      <h1 id="h1">Rank.gg</h1>

      <div class="searchbox">
        <input id="text" class="form-control" type="text" placeholder="Enter your IGN...">
        <button id="button" class="btn btn-default btn-block">See Where You Rank!</button>

      </div>
    </div>


  </div>
</div>

<div class="list">



</div>

【问题讨论】:

  • 您可能应该将代码直接粘贴到此处;)
  • annnnnnn 完成。谢谢:)
  • 你在考虑底部的空白吗??在列表 div 之后??
  • 我添加了一张我在想变成蓝色的白色部分圈圈的照片

标签: html css google-chrome


【解决方案1】:

这是因为#rankjumbo 内部的高度和空白的 div 类“列表”删除了 css .list 并使您的 #rankjumbo 像这样Live Fiddle

#rankjumbo{
margin-top:100px;
margin-bottom: 0;

}

【讨论】:

  • 但为什么在 jsbin 中可以,而我这边却不行?
  • 滚动你的 jsbin 输出或创建一个新的 .. 因为你的 jsbin 过期了,还有一件事你已经设置了全身背景颜色,但是在列表类上你设置了一个高度并设置了背景颜色白色。
  • 好的,我刷新了它。我为“列表”设置的颜色是#eee。这是灰色的颜色。与jumbotron颜色相同
  • 你在#jumborton 上设置颜色了吗?和#808080 这是灰色代码...
  • jsfiddle.net/tjbaezid/0nd0v3rq/4 如果我将 #808080 设置为 jumbotron 和列表的背景色,这里是链接
【解决方案2】:

我通过将引导链接移动到我的 html 中的样式表上方来修复它。

【讨论】:

    猜你喜欢
    • 2014-01-19
    • 1970-01-01
    • 2019-02-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-01
    • 1970-01-01
    • 2016-08-17
    相关资源
    最近更新 更多