У меня возникли проблемы с тем, чтобы высоты на моих divs совпадали. Мне нужно, чтобы они соответствовали высоте div с наибольшим содержанием, что обычно легко, НО я делаю это с наложениями, которые также содержат больше текста. Я не могу сделать это с фиксированной высотой или шириной, потому что мне нужно, чтобы макет был отзывчивым. Ячейки в основном должны быть col-md-2 с самой высокой высотой по мере обтекания текста, это будет больше похоже на квадрат, col-sm-6 будет длинным и узким, а col-xs-12 также будет длинным и узкий.
Это не обязательно должен быть бутстрап, но он должен иметь такой эффект. Другой кикер заключается в том, что мне нужно сделать как можно больше этого встроенного кода, потому что я доставляю его клиенту для вставки на их сайт drupal, не имея большого доступа к серверной части, поэтому, пожалуйста, игнорируйте мой грубый встроенный код.
У меня почти получилось, оверлеи работают, и высота определяется содержимым, но я просто не могу добиться соответствия высоты самой длинной. Может ли кто-нибудь увидеть, что я делаю неправильно здесь ??
#table{
display: table;
border-collapse: collapse;
width: 100%;
}
.tr{
display: table-row;
}
.td{
display: table-cell;
vertical-align: top;
text-align: center;
height: 100%;
}
.overlay {
position: absolute;
vertical-align: middle;
top: 50%;
left: 50%;
height: 100%;
width: 100%;
background-image: url('https://premium.wpmudev.org/blog/wp-content/uploads/2015/02/fullwidth-small.png');
background-position: center top;
background-size: 500% auto;
opacity: 1;
transition: .5s ease;
}
.overlay:hover {
opacity: 0;
}
.text {
color: white;
height: 100%;
top: 50%;
left: 50%;
font-size: 20px;
position: absolute;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
text-align: center;
opacity: 1;
}
.text:hover {
opacity: 0;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
text-align: center;
}
.cell {
font-size: 14px;
}
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<body>
<div id="table" style="width: 100%">
<div class="td col-md-12" style="background-image: url('https://premium.wpmudev.org/blog/wp-content/uploads/2015/02/fullwidth-small.png');
background-position: center top;
background-size: 500% auto; text-align: center; padding-top: 10%; padding-bottom: 10%">test</div>
</div>
<div id="table">
<div class="td col-md-2 col-md-offset-1 col-sm-6 col-xs-12"
style="color: #0169A9; -webkit-box-shadow:inset 0px 0px 0px 6px #0169A9; -moz-box-shadow:inset 0px 0px 0px 6px #0169A9;
box-shadow:inset 0px 0px 0px 6px #0169A9; font-size: 14px;
font-weight: bold;
margin-top: 15px;
padding-top: 15px;
padding-bottom: 15px;
line-height: 1.2;">To find out more about the making of this toolkit, click here
<div class="overlay text">
Test this
</div>
</div>
<div class="td col-md-2 col-sm-6 col-xs-12" style="color: #0169A9; -webkit-box-shadow:inset 0px 0px 0px 6px #0169A9; -moz-box-shadow:inset 0px 0px 0px 6px #0169A9;
box-shadow:inset 0px 0px 0px 6px #0169A9; font-size: 14px;
font-weight: bold;
margin-top: 15px;
padding-top: 15px;
padding-bottom: 15px;
line-height: 1.2;">To find out more about the making of this toolkit
<div class="overlay text">
Test this
</div>
</div>
<div class="td col-md-2 col-sm-6 col-xs-12" style="color: #0169A9; -webkit-box-shadow:inset 0px 0px 0px 6px #0169A9; -moz-box-shadow:inset 0px 0px 0px 6px #0169A9;
box-shadow:inset 0px 0px 0px 6px #0169A9; font-size: 14px;
font-weight: bold;
margin-top: 15px;
padding-top: 15px;
padding-bottom: 15px;
line-height: 1.2;">To find out more about the making of this toolkit, click here toolkit, click here
<div class="overlay text">
Test this
</div>
</div>
<div class="td col-md-2 col-sm-6 col-xs-12" style="color: #0169A9; -webkit-box-shadow:inset 0px 0px 0px 6px #0169A9; -moz-box-shadow:inset 0px 0px 0px 6px #0169A9;
box-shadow:inset 0px 0px 0px 6px #0169A9; font-size: 14px;
font-weight: bold;
margin-top: 15px;
padding-top: 15px;
padding-bottom: 15px;
line-height: 1.2;">To find out more about the making of this toolkit, click here
<div class="overlay text">
Test this
</div>
</div>
<div class="td col-md-2 col-sm-6 col-xs-12" style="color: #0169A9; -webkit-box-shadow:inset 0px 0px 0px 6px #0169A9; -moz-box-shadow:inset 0px 0px 0px 6px #0169A9;
box-shadow:inset 0px 0px 0px 6px #0169A9; font-size: 14px;
font-weight: bold;
margin-top: 15px;
padding-top: 15px;
padding-bottom: 15px;
line-height: 1.2;">To find out more about the making of this toolkit, click here
<div class="overlay text">
Test this
</div>
</div>
<div class="clear-all">
</div>
</div>
</body>