【发布时间】:2019-10-25 15:52:36
【问题描述】:
我正在调整 Hugo 主题的 html / css,但找不到将文本框设置为统一高度的资源。图像显示当前框,高度根据文本数量而变化。
文本框看起来像:
主题部分 /layouts/partials/service.html 如下所示:
{{"<!-- /section title -->" | safeHTML }}
{{ range .Site.Data.service.serviceItem}}
{{"<!-- Single Service Item -->" | safeHTML }}
<article class="col-lg-3 col-md-3 col-12 wow fadeInUp" data-wow-duration="500ms">
<div class="service-block text-center">
<div class="service-icon text-center">
<i class="{{ .icon }}"></i>
</div>
<h3>{{ .title }}</h3>
<p>{{ .content }}</p>
</div>
</article>
{{"<!-- End Single Service Item -->" | safeHTML }}
{{ end }}
该部分的 CSS 如下所示:
.service-2 .service-item {
border: 1px solid #eee;
margin-bottom: 30px;
padding: 50px 20px;
transition: all 0.3s ease 0s;
}
.service-2 .service-item:hover {
box-shadow: 0 5px 65px 0 rgba(0, 0, 0, 0.15);
-webkit-box-shadow: 0 5px 65px 0 rgba(0, 0, 0, 0.15);
}
.service-2 .service-item:hover i {
background: #fff;
color: #57cbcc;
}
.service-2 .service-item i {
font-size: 30px;
display: inline-block;
background: #57cbcc none repeat scroll 0 0;
border-radius: 30px;
box-shadow: 0 5px 6px 0 rgba(0, 0, 0, 0.1);
color: #fff;
height: 200px;
line-height: 55px;
margin-bottom: 20px;
width: 55px;
transition: all 0.3s ease 0s;
}
有没有办法在这些文本框上设置固定高度?
【问题讨论】:
-
可以尝试通过js获取
service-block容器中高度值最高的那个,然后在所有容器上设置这个值。 -
js 太过分了。 flexbox 可以。我稍后会发布我的答案
标签: html css bootstrap-4 blogdown