calc()を使用して画面上で分割された 3 つの垂直行があります 。各ボックス タイプの高さを設定するために JS を使用しています。
width: calc(1/3 * 100%);
これは、各ブロックの高さを設定する JavaScript です。高さを幅に等しく設定し、長いボックスの場合は高さを幅の半分に設定します。
$('.box1').height( $('.box1').width() );
$('.box2').height( $('.box2').width() / 2 );
$('.box4').height( $('.box4').width() );
行の列間に奇妙なオフセットがあります (スクリーンショットを参照)
ここでページを表示できますhttp://cloudlabme.webhosting.be/4sr
縦2列のHTMLです
<div class="container">
<div class="row">
<div class="box box4 box-event" style="background-image: url(build/img/events/2.jpg)"><h1>II</h1></div>
<div class="box box2 box-medium"></div>
</div>
<div class="row">
<div class="box box2 box-light"></div>
<div class="box box1 box-dark"><h3>Hier</h3></div>
<div class="box box1 box-medium"></div>
<div class="box box2"></div>
</div>
</div>
これは私のCSSです
.container {
position: relative;
width: 100%;
max-width: $breakpoint;
margin: 0 auto;
z-index: 0;
}
.row {
float: left;
width: calc(1/3 * 100%);
background: #f2f2f2;
}
/* BOX */
.box {
&.box-light {background: #fff;}
&.box-medium {background: #666;}
&.box-dark {background: #111;}
}
.box1 {
float: left;
width:50%;
background: #ff4444;
}
.box2 {
clear: left;
width: 100%;
background: #ff6666;
}
.box4 {
clear: left;
width: 100%;
background: #ff8888;
}
ありがとう!これは私の脳を殺しています!