0
在父母給定兩個div如何讓我們定義父寬度並強制另一個包裝?我接受涉及桌面或js的解決方案,但對它們不感興趣。一個孩子設置父寬度,一個包裝
HTML:
<div class="parent">
<div class="header">This should not wrap</div>
<div class="text">This should wrap to the header's width. This should not cause the parent to grow.</div>
</div>
CSS:
.parent {
display: inline-block;
border-style: solid;
border-width: 1px;
}
.header {
white-space:nowrap;
}
.text {
/*what goes here?*/
}
BuddhistBeast,我已經適應了這個解決方案,我的需求。非常感謝您的參與。 – Andreas
你懂了!很高興能夠幫助! – BuddhistBeast