Jukka already presented a solution without the float, but with a css table.

In your setting,  you wanted the floating div to have a shrink-to-fit
width (CSS2.1: 10.3.5) that equals to the width of the image, so the
width of the text without breaks must not become the preferred width
of the float.
I can't think of a good solution. You may position the p absolutely in
its static position (without top, left, ...) to take it out of the
float and reserve some vertical space for this block. By doing so, the
p cannot interfere with the shrink-to-fit calculation (but it would
overflow the float if a word becomes very long).
But that is of course just experimental and not possible in a complex layout.

Ingo


<!DOCTYPE html><html><head><title></title><style> div { float: left;
background: blue; position: relative; padding: 5px 0 3em 0; } img {
width: 100px; height: 25px; background: yellow; display: block; } p {
position: absolute; background: fuchsia; margin: 0;
}</style></head><body>  <div>    <img
src="http://satzansatz.de/img/semi404040.gif";>    <p>to the aid of the
party</p>  </div></body></html>
______________________________________________________________________
css-discuss [css-d@lists.css-discuss.org]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to