3 回答
TA贡献1836条经验 获得超3个赞
我在任何地方都没有看到display: flex规则。从这里开始,然后删除列宽,因为它们违背了弹性布局的目的。
.row {
display: flex;
}
.column {
padding: 0 20px;
}
.services {
align-items: center;
justify-content: center;
}
.services-title {
font-family: "Ibarra Real Nova", serif;
align-items: center;
color: rgba(40, 44, 48, 1);
font-weight: bold;
text-align: center;
font-size: 45px;
}
.services-text {
font-family: "Lato", sans-serif;
text-align: justify;
line-height: 1.8;
letter-spacing: 0em;
font-size: 16px;
font-weight: 300;
}
<div class="row services">
<div class="column">
<div class="first-column">
<h3 class="services-title">
Content <br />
Creation
</h3>
<div class="services-text">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Aenean commodo ligula eget dolor. Aenean massa. Cum sociis
natoque penatibus et magnis dis parturient montes, nascetur
ridiculus mus. Donec quam felis, ultricies nec, pellentesque
eu.
</div>
</div>
</div>
<div class="column">
<div class="second-column">
<h3 class="services-title">
Strategy <br />
Session
</h3>
<div class="services-text">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Aenean commodo ligula eget dolor. Aenean massa. Cum sociis
natoque penatibus et magnis dis parturient montes, nascetur
ridiculus mus. Donec quam felis, ultricies nec, pellentesque
eu.
</div>
</div>
</div>
<div class="column">
<div class="third-column">
<h3 class="services-title">Branding</h3>
<div class="services-text">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Aenean commodo ligula eget dolor. Aenean massa. Cum sociis
natoque penatibus et magnis dis parturient montes, nascetur
ridiculus mus. Donec quam felis, ultricies nec, pellentesque
eu.
</div>
</div>
</div>
</div>
TA贡献1824条经验 获得超5个赞
和align-items:center都justify-items:center在 CSS 网格中工作。您的问题可能与其他 CSS 影响网格的高度/宽度或样式规则display:grid本身的位置有关:
html, body{height: 100%}
.grid{
height: 60%;
display: grid;
grid-template-columns: 1fr 1fr;
background-color: salmon;
align-items: center;
justify-items: center;
}
<div class="grid">
<div>Lorem ipsum</div>
<div>Lorem ipsum lorem ipsum</div>
</div>
- 3 回答
- 0 关注
- 113 浏览
添加回答
举报