Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

white-space: nowrap is not working in IE in a horizontally scrolling box

Tags:

css

I'm using white-space: nowrap combined with inline-block'd elements to create a horizontally scrolling box. For some reason, in IE, the white-space: nowrap is being ignored and items are wrapping.

like image 940
Ben Johnson Avatar asked Aug 08 '13 14:08

Ben Johnson


People also ask

Can I use white space Nowrap?

If you want to prevent the text from wrapping, you can apply white-space: nowrap; Notice in HTML code example at the top of this article, there are actually two line breaks, one before the line of text and one after, which allow the text to be on its own line (in the code).

What is white space Nowrap?

nowrap : Multiple whitespaces are collapsed into one, but the text doesn't wrap to the next line.

What does white space pre line mean?

pre-line. Sequences of whitespace will collapse into a single whitespace. Text will wrap when necessary, and on line breaks.


1 Answers

Found it! We were using word-wrap: break-word higher up. It seems that word-wrap interferes with white-space in Internet Explorer. Fix for this was to set word-wrap: normal on the element with white-space: nowrap.

like image 184
Ben Johnson Avatar answered Sep 23 '22 12:09

Ben Johnson