我想限制hd的宽度,但不必设置宽度。我希望它占据全部可用宽度(父母的宽度吗?)
.wrapper {
outline: 1px #000 solid;
width: 600px;
margin: auto;
display: flex;
}
.left {
flex-grow: 1
}
.left h1 {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis
}
.right {
width: 200px;
background-color: #CCC;
}
<div class="wrapper">
<div class="left">
<h1>this is a really really really long heading</h1>
</div>
<div class="right">right</div>
</div>