I have a bunch of columns of info that look like this:
<span style="width:280px;float:left">
some stuff
<span>
<span style="width:280px;float:left">
some stuff
<span>
<span style="width:280px;float:left">
some stuff
<span>
<span style="width:280px;float:left">
some stuff
<span>
etc . .
given that people have different browser widths, if a person has a monitor with a small width, some of the columns wind up wrapping to the next line. In this case, i would want a horizontal scroll bar to show up and keep everything on the same line. What is the correct way of doing this?
Simply place your
span
elements in a container:Then remove the
float
property from yourspan
elements, and instead set them todisplay
asinline-block
and give your new containing element awhite-space
ofnowrap
to prevent them from falling onto a new line:If you really insist on using the
style
property on each individual element (which is bad practice) instead of including CSS like I've used above, this would be equal to: