首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使全彩色md-2屏幕的背景色变黑

使全彩色md-2屏幕的背景色变黑
EN

Stack Overflow用户
提问于 2016-11-09 19:03:35
回答 1查看 380关注 0票数 0

我试着制作简单的菜单,我的目标是使完整的col-md-2屏幕的背景色变成黑色(如图像- 1),但是当菜单的文本/无线电按钮/等等结束时,col-md-2的其余空白屏幕就会呈现身体的背景色(在图像-2中),而不是我的div的背景色。虽然我在我的身体背景色之后提到了我的<div>背景色,但我的代码如下:

代码语言:javascript
复制
<!DOCTYPE html>
<html lang="en">
<head>
    <title>ProductExchanger</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- ONLINE -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<body style="color: white ; background-color: #2aabd2 ; ">

<!-- ONLINE -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>


<div class="col-md-2" style="padding: 0 ;  background-color: #000000">
    <div class="container-fluid" style="background-color: darkmagenta">
        <h3>CATEGORY : </h3>
        <form>
            <div class="radio">
                <label><input type="radio" name="electronicsC">ELECTRONICS</label>
            </div>
            <div class="radio">
                <label><input type="radio" name="vehiclesC">VEHICLES</label>
            </div>
            <div class="radio">
                <label><input type="radio" name="furnitureC">FURNITURE</label>
            </div>
            <div class="radio">
                <label><input type="radio" name="propertyC">PROPERTY</label>
            </div>
            <div class="radio">
                <label><input type="radio" name="petsAndAnimalsC">PETS AND ANIMALS</label>
            </div>
            <div class="radio">
                <label><input type="radio" name="hobbyAndSportsC">HOBBY AND SPORTS</label>
            </div>
            <div class="radio">
                <label><input type="radio" name="foodAndAgriculture">FOOD AND AGRICULTURE</label>
            </div>
            <div class="radio">
                <label><input type="radio" name="otherC">OTHER</label>
            </div>
        </form>
    </div>

    <div class="container-fluid" style="background-color: midnightblue ">
        <h3>DIVISION : </h3>
        <form>
            <div class="radio">
                <label><input type="radio" name="dhakaD">DHAKA</label>
            </div>
            <div class="radio">
                <label><input type="radio" name="chittagongD">CHITTAGONG</label>
            </div>
            <div class="radio">
                <label><input type="radio" name="rajshahiD">RAJSHAHI</label>
            </div>
            <div class="radio">
                <label><input type="radio" name="rangpurD">RANGPUR</label>
            </div>
            <div class="radio">
                <label><input type="radio" name="khulnaD">KHULNA</label>
            </div>
            <div class="radio">
                <label><input type="radio" name="barisalD">BARISAL</label>
            </div>
            <div class="radio">
                <label><input type="radio" name="sylhetD">SYLHET</label>
            </div>
        </form>
    </div>
</div>

</body>
</html>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-11-09 19:32:30

代码语言:javascript
复制
<!DOCTYPE html>
<html>

  <head>
    <link data-require="bootstrap-css@3.3.6" data-semver="3.3.6" rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.css" />
    <style>
      .col-vh {
        background-color: #000;
        height: 100vh;
      }
    </style>
  </head>

  <body>
    <div class="container">
      <div class="row">
        <div class="col-md-2 col-vh">
          Lorem Ipsum
        </div>
      </div>
    </div>
  </body>

</html>

将100 the添加到您的列中,它应该是视图的100%。看这个柱塞

不同的方法工作在你的身体标签上的最小高度和高度。详见这个问题。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40514180

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档