div with float next to div with width

Posted by dragonfly on Stack Overflow See other posts from Stack Overflow or by dragonfly
Published on 2010-05-10T11:12:18Z Indexed on 2010/05/10 11:24 UTC
Read the original article Hit count: 259

Filed under:
|

Hi,

I have html:

<div class="field-label"><label>Email: </label></div>
<div class="field"><input class="input" ......></div>

and piece of css:

.field-label  { clear:left; float:left; padding:0.5em; width:6em;  }
.field { padding:0.5em; }

And it worked fine. But for some elements I wanted to apply following change: when I add width to .field class layout goes to blazes: element with .field class appears under element with field-label class. Container of whole form is width enough to hold elements with field-label & field class.

Why is it happening, did I miss something in css basics?

Thanks ,Pawel

© Stack Overflow or respective owner

Related posts about css

Related posts about width