Hi,
We have divs that have text and a background colour. We want the background colour to only be the width of the text and for the text to not wrap. We have given the div a small width and just allowed the text to push out the div. This works fine in IE and NN6, but NN7 seems to keep the div at the small size we've given it and allow the text to extend outside (properly preventing word wrapping). Of course, providing width:100% causes the div to go the full width of the screen which is not what we're looking for.
How can we get the div to be the exact size of the non-wrapping text and not stop at the specified width? Here is the code:
Thanks!
Education is what you get from reading the small print.
Experience is what you get from not reading it.
We have divs that have text and a background colour. We want the background colour to only be the width of the text and for the text to not wrap. We have given the div a small width and just allowed the text to push out the div. This works fine in IE and NN6, but NN7 seems to keep the div at the small size we've given it and allow the text to extend outside (properly preventing word wrapping). Of course, providing width:100% causes the div to go the full width of the screen which is not what we're looking for.
How can we get the div to be the exact size of the non-wrapping text and not stop at the specified width? Here is the code:
Code:
<div style="
position:relative;
background-color:#818181;
color:#fff;
width:5%;
white-space: nowrap;">Winnipeg Weather</div>
Thanks!
Education is what you get from reading the small print.
Experience is what you get from not reading it.