Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Make div width of text in Netscape 7 1

Status
Not open for further replies.

saroy71

Programmer
May 16, 2002
22
CA
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:

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.
 
use tables > turn off the border > throw a div aroud it > done

______________________________________________________________________________
"The sluggard does not plow after the season, so he begs during the harvest and has nothing."
-[Proverbs 20:4]


 
I can't use a table. That isn't proper coding. Tables are only to be used for tabular information like a spreadsheet not for formating.

Any other ideas?

Education is what you get from reading the small print.
Experience is what you get from not reading it.
 
oh, sorry man, i didnt read your post good enough at first, sorry about that...

well I think you might try a span tag like this:

<span style="background='#EFEFEF'">Hello</span>

that outta work for you, hopefully...

co

______________________________________________________________________________
"The sluggard does not plow after the season, so he begs during the harvest and has nothing."
-[Proverbs 20:4]


 
Worked perfect. Thanks mate


Education is what you get from reading the small print.
Experience is what you get from not reading it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top