Forum Moderators: not2easy

Message Too Old, No Replies

Show styles to IE only?

trying to understand hacks...

         

tonynoriega

9:22 pm on Feb 4, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



how do i only show this to Internet Explorer?

#nav ul {display:inline-block;}
#nav ul {display:inline;}
#nav ul li {float:left;}
#nav {text-align:center;}

it is in my global stylesheet, but kind of throws off in FireFox...

it is needed to show dropdown elements in my navigation for IE6...

is this possible?

SuzyUK

9:31 pm on Feb 4, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



use Conditional comments [webmasterworld.com]

you can even target the version number if you want to get specific, e.g. if IE6 and below needs the code but IE7 doesn't

e.g.

<!--[if lte IE 6]>
<your code/stylesheet link in here>
<![endif]-->

read as if this is IE version less than or equal to 6 (lte - less than or equal to)

you can be more general with [if IE] - that targets all versions of IE

or you can get very specific [if IE 6] which will only target version 6

with them all what ever code you put between, the opening and closing will be read by only the IE versions you specify, that code can be HTML, inline CSS, some JS.. or a linked stylesheet the choice is yours ;)

-Suzy

tonynoriega

9:58 pm on Feb 4, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Got it...

works great...

i just linked to another style sheet called IEstyle.css

but got a new issue...

#nav {position:relative; z-index:1000; margin:0 auto;}

even though i have this set, on my homepage, the navigation still shows up behind the form elements on my home page...

specifically two <select> menus i have...

in IE6 only....IE7 and FF are fine...

fix for this?

SuzyUK

3:19 pm on Feb 5, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



fix for this?

basically select elements are, (were? - I think something changed in IE7), separate entities they are 'windowed elements' and will always appear on top of other "windowless elements" much like an iframe. There are some workarounds out there which involve using scripts to hide the windowed element when some other elements needs to drop down over the top of it..

see: Microsoft KB Article INFO: How the Z-index Attribute Works for HTML Elements [support.microsoft.com]. for more on this

glad the other bit helped though!

-Suzy

added: try a search for: [How to cover an IE windowed control]

[edited by: SuzyUK at 5:24 pm (utc) on Feb. 5, 2008]