我正在使用引导程序的ROW和COL制作食物菜单,我不确定这样做是否正确,因为我在行与行之间留有空隙。
应如何显示:
但是我明白了:
如您所见,行之间存在巨大的差距
我的代码: jsFiddle HTML
<div class="row">
<div class="col-9">
<h3 class="menu-dish">Chateau D'Armailhac Rothschild Pauillac 5-Eme G.C.C.</h3>France
</div>
<div class="col-3">
<div class="row">
<div class="col-6 price">
123 usd
</div>
<div class="col-6 price">
123 usd
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-9">
<h3 class="menu-dish">Chateau D'Armailhac Rothschild Pauillac 5-Eme G.C.C.</h3>France
</div>
<div class="col-3">
<div class="row">
<div class="col-6 price">
123 usd
</div>
<div class="col-6 price">
123 usd
</div>
</div>
</div>
</div>
CSS
.price {
border-left: 1px solid black;
border-right: 1px solid black;
}
.price:first-child{
border-left:none;
}
.price:last-child{
border-right:none;
}
答案 0 :(得分:2)
使用h-100
嵌套row
请参阅bootstrap-4中的大小:https://www.w3schools.com/bootstrap4/bootstrap_utilities.asp
.price {
border-left: 1px solid black;
border-right: 1px solid black;
}
.price:first-child{
border-left:none;
}
.price:last-child{
border-right:none;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
<div class="row">
<div class="col-9">
<h3 class="menu-dish">Chateau D'Armailhac Rothschild Pauillac 5-Eme G.C.C.</h3>France
</div>
<div class="col-3">
<div class="row h-100">
<div class="col-6 price">
123 usd
</div>
<div class="col-6 price">
123 usd
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-9">
<h3 class="menu-dish">Chateau D'Armailhac Rothschild Pauillac 5-Eme G.C.C.</h3>France
</div>
<div class="col-3">
<div class="row h-100">
<div class="col-6 price">
123 usd
</div>
<div class="col-6 price">
123 usd
</div>
</div>
</div>
</div>
答案 1 :(得分:1)
我刚刚在col内的行中添加了100%的高度,希望您正在寻找这个。 让我知道。
http://jsfiddle.net/sarojuid/uo92x6yt/
.row {
min-height:100%;
}