繁体   English   中英

使完整的col-md-2屏幕的背景色为黑色

[英]make full col-md-2 screen's background color black

这就是我试图做的 这是发生了什么事

我试图做一个简单的菜单,我的目标是将col-md-2屏幕的背景全色设为黑色(如图像-1),但是当texts / radiobutton / etc时。 菜单结束, col-md-2的空白屏幕的其余部分使用主体的背景色(在图2中)而不是我的div的背景色。 尽管我分别在我身体的背景色之后提到了<div>的背景色。 这是我的代码:

<!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>
<!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>

将100vh添加到您的列中,它应该是视口的100%。 见这个笨蛋

不同的方法在身体标签上使用最小高度和最小高度。 有关详细信息,请参见此问题。

暂无
暂无

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

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