【发布时间】:2017-12-29 00:31:07
【问题描述】:
我有两行四个 div,每行通过flexbox 设置以水平跨越页面。因此,div 的width 是动态的,并且始终适应窗口宽度。
div 的高度取决于其内容,即内容的font-size。我想设置 div 的 CSS 以便它们始终垂直填充窗口,而不是通过设置 height 而是通过 font-size 更改。
我所描述的可能吗?有关页面的当前设置,请参见下面的小提琴:
.banner {
font-size: 5vw;
}
.flex {
display: flex;
}
.row {
flex-direction: row;
justify-content: space-between;
}
.box {
flex: 1;
text-align: center;
border: 1px solid black;
background-color: white;
box-sizing: border-box;
}
<div class="top" id="top">
<div>
<div class="flex row banner">
<div class="box rotate-right">
<p>
1
</p>
</div>
<div class="box rotate-left">
<p>
2
</p>
</div>
<div class="box rotate-right">
<p>
3
</p>
</div>
<div class="box rotate-left">
<p>
4
</p>
</div>
</div>
<div class="flex row banner">
<div class="box rotate-right">
<p>
5
</p>
</div>
<div class="box rotate-left">
<p>
6
</p>
</div>
<div class="box rotate-right">
<p>
7
</p>
</div>
<div class="box rotate-left">
<p>
8
</p>
</div>
</div>
</div>
</div>
【问题讨论】:
标签: html css responsive-design font-size