Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Oct 2009
    Location
    London, ON
    Posts
    112
    Thanks
    4
    Thanked 0 Times in 0 Posts

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

    Hi Everyone,

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

    Code:
    <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:
    Code:
    <!--[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

  • #2
    New Coder
    Join Date
    Jun 2010
    Location
    The Netherlands
    Posts
    52
    Thanks
    0
    Thanked 6 Times in 6 Posts
    Embedded CSS is created by using the style tags.

    Code:
      <style type="text/css">
      body {
        color: purple;
        background-color: #d8da3d }
      </style>
    So for your little code up there, it would be:
    Code:
    <!--[if IE 6]>
    <style type="text/css">
         #navbar li.mainnav { display: inline-block; }
    </style>
    <![endif]-->

  • Users who have thanked Candan for this post:

    nickHiebert (06-23-2010)

  • #3
    Regular Coder
    Join Date
    Oct 2009
    Location
    London, ON
    Posts
    112
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Candan View Post
    Embedded CSS is created by using the style tags.

    Code:
      <style type="text/css">
      body {
        color: purple;
        background-color: #d8da3d }
      </style>
    So for your little code up there, it would be:
    Code:
    <!--[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.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •