The following html page looks great in any browser, but IE 8 and 9:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> </head> <body> <div style="width: 300px"> <span style="white-space: nowrap;"> <input type="radio" value="1" name="test" />Choice 1 </span> <span style="white-space: nowrap;"> <input type="radio" value="2" name="test" />Choice 2 </span> <span style="white-space: nowrap;"> <input type="radio" value="3" name="test" />Choice 3 </span> <span style="white-space: nowrap;"> <input type="radio" value="4" name="test" />Choice 4 </span> <span style="white-space: nowrap;"> <input type="radio" value="5" name="test" />Choice 5 </span> <span style="white-space: nowrap;"> <input type="radio" value="6" name="test" />Choice 6 </span> <span style="white-space: nowrap;"> <input type="radio" value="7" name="test" />Choice 7 </span> </div> </body> </html>
The html looks pretty straight forward, but IE 8 and 9 ignore the width of the div and force all options on the same line to be selected (IE 7 and all other browsers other than IE wrap 300 pixels as they are used). Somehow I need this switch list to wrap with the specified width, without separating the radio from the corresponding selection.
I can make IE 8 and 9 behave if I change the doctype, however I would like to avoid the change if possible.
I get the same behavior if I use the old school "nobr" tags instead of span tags instead of span tags.
source share