5 replies [Last post]
nuke
Offline
newbie
Last seen: 16 years 8 weeks ago
Joined: 2003-05-27
Posts: 5
Points: 0

div#rightmenu {
	float: right;
	width: 10px;
	voice-family: "\"}\"";
	voice-family: inherit;
	float: right;
	width: WHAT TO PUT HERE FOR SAFARI/OPERA TO USE?
	
}

Basically this code is meant to prey on an IE parsing bug, the float and width attributes above the
	
voice-family: "\"}\"";
voice-family: inherit;

are used by IE and the code below (float:right;) is seen by browsers without the bug.

Housed in this div is a vertical menu, and I want the div to adjust its width to fit the links in it without my help. However, setting the width to nothing (omitting the width attribute completely) doesn't work in IE. Here instead, the DIV expands to fill up the entire width of the TD it resides in. I tried then to set the DIV width to 10px (too small, yes) and IE resizes correctly to fit the menu content (and this is probably not correct but it looks like it's supposed to...)

With this width however, safari uses the 10px and the rest of the menu pokes out to the right outside the DIV giving a pretty goofy result.

Can I instead of not writing anything for width type in a null value for safari?

(man, I'm getting SICK of IE... get with the program M$!!)[/code]

dJomp
dJomp's picture
Offline
Enthusiast
Last seen: 3 years 24 weeks ago
Joined: 2003-03-23
Posts: 422
Points: 0

How to give attributes "null" values?

width: auto; is all I can think of right now. I think that's the W3 recommended default value (note the recommended, you never know...)

You know you're a geek when you try to shoo a fly away from the monitor with your cursor.

nuke
Offline
newbie
Last seen: 16 years 8 weeks ago
Joined: 2003-05-27
Posts: 5
Points: 0

How to give attributes "null" values?

It appears as if the parsing bug is a windows only thing, IE 5.2 for os x uses the same code as safari does, so width:auto works the same as omitting the attribute.

So a DIV with float: right; will stretch it's width to 100% if you don't specify a value for it. (an explorer only "feature"...)

Any other ideas how this might be done? I could just set the width to 200px and mind the length of the links I put in the menu but that's not really how it's supposed to be done is it.

Grrr, M$ :roll:

dJomp
dJomp's picture
Offline
Enthusiast
Last seen: 3 years 24 weeks ago
Joined: 2003-03-23
Posts: 422
Points: 0

How to give attributes "null" values?

Some javascript? I don't use Javascript, but others on this forum do - it would be easy to add something along the lines of:

NOTE THIS IS PSEUDOCODE
if browser is IE then
  include a certain CSS file
else
  incluse a different CSS file
end if

I've got a similar effect using PHP.

You know you're a geek when you try to shoo a fly away from the monitor with your cursor.

Sven
Sven's picture
Offline
Enthusiast
Brisbane, Australia
Last seen: 12 years 6 weeks ago
Brisbane, Australia
Timezone: GMT+10
Joined: 2003-03-12
Posts: 166
Points: 0

How to give attributes "null" values?

Have you considered using an inline element instead, or using a block element other than DIV?

Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 16 hours 58 sec ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5342
Points: 2963

How to give attributes "null" values?

Hi Nuke,
What doctype are you using :?:
Doctypes can have a major affect on how the browser renders the page.
It might be worth trying a different one.
Here's a list of Doctypes to check out.