【发布时间】:2019-07-08 02:01:18
【问题描述】:
我想避免对 HTML 进行任何更改,因为这可能会导致其他布局和设计的回归。因为我们在所有设计和布局中使用相同的模板。
需要在不使用.content2 的绝对位置的情况下实现以下布局。并且content2 和content3 的高度应该相等。
.wrapper {
display: flex;
}
.content {
background: red;
}
.content2 {
background: green;
}
.content3 {
background: yellow;
}
.newLayout {
position: relative;
}
.newLayout .content2 {
position: absolute;
right: 0;
width: 92px;
padding: 2px 10px;
}
.newLayout .content3 {
white-space: nowrap;
margin-top: 20px;
padding: 10px;
}
<div class="wrapper newLayout">
<div class="content">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It
has survived not only five centuries, but also the leap into electronic typesetting, remaining essentia</div>
<div class="content2">Content Two</div>
<div class="content3">Content Three</div>
</div>
【问题讨论】:
标签: html css flexbox css-position