更改引导程序中网格的背景颜色,包括它未到达的侧面

抱歉,如果这措辞不好,所以如果我有这样的东西


<body>

<main role="main" class="container">

  <div class="row">

  <div class="col-sm-4">1</div>

  <div class="col-sm-4">2</div>

  <div class="col-sm-4">3</div>

  <div class="col-sm-6">Some Text</div>

  <div class="col-sm-6">Some Text</div>

  <div class="col-sm-12">6</div>

</div>

</main>

</body>

我想将 #test 的颜色更改为其他颜色,但如果我这样做


body {

   background-color: grey;

}

#test {

   background-color: yellow;

   background-size: cover;

}

它只会为网格的背景着色,而不是整个页面。页面的两侧将保持白色,我不知道如何解决这个问题


我希望黄色到达页面边缘

黄色未到达的示例


一只甜甜圈
浏览 58回答 2
2回答

杨魅力

对于页面的 backgorung 添加 css 作为body {&nbsp; background-color: grey;}为了使网格的背景不同,将网格id作为#test并将CSS应用为#test {&nbsp; background-color: yellow;&nbsp; border: 1px solid red;&nbsp; height: 20px;}并将你的main班级更改为<main class = "container-fluid">看看下面的图片注意:&nbsp;Body更改页面整体的颜色,同时#test更改指定给相应类的测试 ID 的颜色。

慕勒3428872

只需添加&nbsp; &nbsp; #test&nbsp; &nbsp; &nbsp;{&nbsp; &nbsp; &nbsp;Background-color:grey;&nbsp; &nbsp; &nbsp;background-size:cover}&nbsp;
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Html5