SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2004
    Location
    UK
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    IE Conditional Comment Fail

    I'm trying to code a site for Firefox (and IE7 pretty much, well done MS, for once) and conditionally link in a few modified styles for IE6, but it doesn't work!

    Boo hisss... can anyone help? IS this the wrong way to do it? I even try crazy classes in the files, changing background colours etc. and nothing happens...

    The Comment:

    HTML Code:
    <!--[if lte IE 7]>
     <link href="../css/site2_ie6.css" rel="stylesheet" type="text/css">
     <![endif]-->
    Original CSS Class:
    Code:
    .middle {
     	background-color: #FFFFFF;
     	width: 610px;
     	float: left;
     	padding: 10px;
     	clear: none;
     	height: auto;
     	margin: 0px 10px;}
    Conditional CSS File (site2_ie6.css):
    Code:
     /* CSS Document */
     .middle {width: 600px; padding: 5px;}

  2. #2
    SitePoint Guru Rob_D's Avatar
    Join Date
    Oct 2006
    Location
    UK
    Posts
    882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Make sure that the link to the ie6 style sheet comes after any other styles and that the href is correct.

  3. #3
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    39,877
    Mentioned
    160 Post(s)
    Tagged
    4 Thread(s)
    Hi,

    You didn't say what the problem was except that it didn't work.

    If you are trying to give styles to ie7 and all other ie versions then your code works perfectly. If you want to give the styles to all ie except ie7 then you are using the wrong syntax.

    lte = Less than or equal to

    lt = Less Than

    If you are using the multiple iE standalones then you need to fix then to work with conditional comments anyway.

    http://www.positioniseverything.net/...s/multiIE.html

  4. #4
    SitePoint Enthusiast
    Join Date
    Aug 2004
    Location
    UK
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Hmm...

    I managed to get a body tag border to work.

    But I think before the problem was with defining rules already within the main css file.

    I will have to wait until tomorrow before I can check this. Thanks for your responses, I'll let you know..

    rich

  5. #5
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,495
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'll be home in about half an hour. I'll see what I can muster for you .

  6. #6
    SitePoint Enthusiast
    Join Date
    Aug 2004
    Location
    UK
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    In the end...

    I solved the problem in the end.

    It seems, when I linked the style sheet within a dreamweaver template, the template doesn't read it like a normal link and thus with many files the link was wrong. I just put in a full link and that seemed to solve the problem.

    Does DW freak out with conditional comments?

    rich

  7. #7
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    39,877
    Mentioned
    160 Post(s)
    Tagged
    4 Thread(s)
    Does DW freak out with conditional comments?
    I expect it just treats them as html comments - which is really all they are. It's only ie that recognises something in there.

  8. #8
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,495
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It looks like it might, I got your code to work on my end... though I was going to suggest that you change lte IE 7 to lt IE 7 so it doesn't include Intenet Explorer 7 in the mix.

  9. #9
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    39,877
    Mentioned
    160 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by Dan
    though I was going to suggest that you change lte IE 7 to lt IE 7
    Quote Originally Posted by me
    If you want to give the styles to all ie except ie7 then you are using the wrong syntax.

    lte = Less than or equal to

    lt = Less Than

    Great minds think alike

  10. #10
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,495
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Of course we do.

  11. #11
    SitePoint Wizard silver trophybronze trophy Stormrider's Avatar
    Join Date
    Sep 2006
    Location
    Nottingham, UK
    Posts
    3,133
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    ...but fools seldom differ

    Everyone forgets the 2nd half of that phrase...

  12. #12
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    39,877
    Mentioned
    160 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by Stormrider
    ...but fools seldom differ

    Everyone forgets the 2nd half of that phrase...
    lol - I've never heard the second part of that before.... and I like it


Bookmarks

Posting Permissions

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