Monday, April 07, 2008

Internet Explorer 7, Clears and Floats?

Working on a project, I'm have a form, where labels (containing fields) are all floated. In order to force a label to a new line, I put a class on it with "clear: left", but that, for some reason, causes the words to be smushed to the left. If there's a label text with a space in it, IE7 renders it as
first
second
instead of
first second

Anyone run into this before? I'm not css problem savvy enough to know what to Google for. I ended up just putting br's with a "clear: both" class on them in between rows, but it's not as clean as it was before.

2 comments:

Michael Bernstein said...

Without actual HTML+CSS it's hard to tell, but it *looks* like the label size is causing the label text to wrap. There are two general solutions:

1) Quick and Dirty: use a non-breaking space instead of a regular space.

2) More subtle: Start monkeying with the width and display properties of the label to get the right effect (temporarily setting a border and background can help with debugging this), and *maybe* try using the IE-specific 'word-wrap' if all else fails.

Linden said...

It doesn't seem to be the label size, even IE shows the label as being much wider than the text, but I'll try your solutions.. thanks!