

我试着制作简单的菜单,我的目标是使完整的col-md-2屏幕的背景色变成黑色(如图像- 1),但是当菜单的文本/无线电按钮/等等结束时,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>发布于 2016-11-09 19:32:30
<!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%。看这个柱塞。
不同的方法工作在你的身体标签上的最小高度和高度。详见这个问题。
https://stackoverflow.com/questions/40514180
复制相似问题