0
我正在嘗試創建具有相同高度的列和可見排水溝的網格。我有相同的高度欄,但我不能在與body-element(米色)相同的背景色中製作可見的排水溝。我開始認爲我想做的事是不可能的,因爲填充作爲排水溝...無法獲得高度相等的列和可見的排水溝
我很感謝所有的幫助,我可以得到。 My code
編輯我不清楚我想要什麼。我希望能夠改變body-element上的背景顏色,以便它能夠影響陰溝。就像你可以用Bootstrap(我已經聽說它的陰溝設置爲填充)Bootstrap example
請注意,我自己的例子只有一個列大小(.col-6),但我需要能夠使用更多不同大小的列,這就是我沒有使用邊距的原因,因爲它很難計算它們的大小,因此所有列大小+邊距等於100%寬度。
body {
background-color: beige;
}
*, *:after, *:before {
padding: 0;
margin: 0;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.row {
overflow: hidden;
}
.col-6 {
background-color: black;
float: left;
margin-bottom: -99999px;
padding-bottom: 99999px;
padding-right: 1.4em;
width: 50%;
}
[class*='col-']:last-of-type {
padding-right: 0;
}
.row:after {
content: "";
display: table;
clear: both;
}
img {
display: block;
max-width: 100%;
}
.information {
color: white;
}
<div class="row">
<div class="col-6">
<img src="https://cdn.pixabay.com/photo/2016/11/08/05/16/ancient-1807518_960_720.jpg" alt="">
</div>
<div class="col-6">
<div class="information">
<p>Aenean tincidunt ornare lacinia. Suspendisse lacinia bibendum ex, vehicula faucibus mauris ornare at. Fusce nec magna tincidunt urna molestie fringilla.</p>
<p>Nam fermentum, mauris eget elementum sodales, libero mauris egestas urna, vitae tempor felis felis eget augue.</p>
</div>
</div>
</div>
是你想要什麼?:https://jsfiddle.net/7z6hfoL6/ – Banzay