Reputation: 33944
I am using the following html, See this jsfiddle
<div style="float: left;">
<div style="padding-left: 3px; padding-top: 3px;">
<div style="float: left;">
Title:
</div>
<div style="float: left; padding-left: 12px">
ABC
</div>
<div style="clear: both"></div>
</div>
<div style="padding-left: 3px; padding-top: 3px;">
<div style="float: left;">
Lyrics:
</div>
<div style="float: left; padding-left: 3px">
<div style="overflow: hidden; width: 180px">
ABC DEF GHI JKl MNO dsa dsa sddsa d s
</div>
<div style="overflow: hidden; width: 180px">
ABC DEF GHI JKl MNO MNO dsa dsa sddsa d s
</div>
</div>
<div style="clear: both"></div>
</div>
</div>
<div style="float: right; border-left: 1px solid black;">
<img src="http://cdn1.iconfinder.com/data/icons/snowish/72x72/actions/gtk-media-play-ltr.png">
</div>
</div>
But my text overflow is not hidden. When I use small text instead of '
ABC DEF GHI JKl MNO dsa dsa sddsa d s
' then everything is fine.
Upvotes: 0
Views: 114
Reputation: 2268
You need to specify a height in order for the container to know where the overflow starts.
Upvotes: 1
Reputation: 167162
white-space: nowrap
: <div style="float: left;">
<div style="padding-left: 3px; padding-top: 3px;">
<div style="float: left;">
Title:
</div>
<div style="float: left; padding-left: 12px">
ABC
</div>
<div style="clear: both"></div>
</div>
<div style="padding-left: 3px; padding-top: 3px;">
<div style="float: left;">
Lyrics:
</div>
<div style="float: left; padding-left: 3px">
<div style="overflow: hidden; white-space: nowrap; width: 180px; ">
ABC DEF GHI JKl MNO dsa dsa sddsa d s
</div>
<div style="overflow: hidden; white-space: nowrap; width: 180px">
ABC DEF GHI JKl MNO MNO dsa dsa sddsa d s
</div>
</div>
<div style="clear: both"></div>
</div>
</div>
<div style="float: right; border-left: 1px solid black;">
<img src="http://cdn1.iconfinder.com/data/icons/snowish/72x72/actions/gtk-media-play-ltr.png">
</div>
</div>
height
explicitly.Upvotes: 4