如果不修復任何元素的寬度,我希望父div元素在設置寬度時忽略文本。我希望元素的寬度僅受圖像寬度的影響。CSS父元素忽略子元素內的文本以確定寬度
<div>
<img src="https://lh4.ggpht.com/9BAW9uE48gxNUmnQ7T6ALpNTsrCHOZBMfF__mbamBC36edSw0uc-kjQxgtZ3O3aQWFY=h900"/>
<p>I want this text to wrap once this paragraph element reaches the width of the image.</p>
</div>
div {
background: green;
display: inline-block;
}
任何意見是
不錯,支持似乎也不是那麼糟糕(IE8 +):https://developer.mozilla.org/en-US/docs/Web/CSS/display – Pevara
老實說,我比你想象的更快樂。 – TaylorMac