...

View Full Version : Howto: add Conditional Comments for IE6/7 only in the head, including the css.



nickHiebert
06-23-2010, 08:56 PM
Hi Everyone,

I have a quick question. I know about conditional comments leading to other css files for your website. Such as:


<head>
<!--[if IE 6]>
<link rel="stylesheet" href="css/styleie6.css" media="screen" />
<![endif]-->
</head>

But I've seen it before. When you put the conditional comments in the header and then put condition comments inside which is where the div tags would go.

So something like this:


<!--[if IE 6]>
#navbar li.mainnav { display: inline-block; }
<![endif]-->

Without having to create another css file. If you understand that.

The website I'm working on is: http://bit.ly/dnzFFe (It's safe just used bit.ly so that google doesn't pick up the site name).

If you look at it in IE 7 and 6 you'll notice the Navigation should be going across and not down. Just look at any other browser for example.

I just want a solution to just putting the css in the header of the html pages for the website. Just like I have done with: #footer p.links

Candan
06-23-2010, 09:00 PM
Embedded CSS is created by using the style tags.



<style type="text/css">
body {
color: purple;
background-color: #d8da3d }
</style>


So for your little code up there, it would be:


<!--[if IE 6]>
<style type="text/css">
#navbar li.mainnav { display: inline-block; }
</style>
<![endif]-->

nickHiebert
06-23-2010, 09:10 PM
Embedded CSS is created by using the style tags.



<style type="text/css">
body {
color: purple;
background-color: #d8da3d }
</style>


So for your little code up there, it would be:


<!--[if IE 6]>
<style type="text/css">
#navbar li.mainnav { display: inline-block; }
</style>
<![endif]-->


Thank you very much. I just wasn't sure and I thought I'd ask.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum