WordPress.org

Ready to get started?Download WordPress

Forums

Alternate stylesheet for IE (14 posts)

  1. Ron Pemberton
    Member
    Posted 9 years ago #

    I have been seriously vexed by this. I have tried using the javascript conditional tags in my header.php to get IE to use a second stylesheet I made, but it doesn't work. I also have tried using a php solution I found here in the threads, but can't get it to work either. I t has to be something I'm doing wrong, if other people have implemented both approaches successfully.

    Could someone explain to me charactor for charactor what to write and on what line in my header.php to put. Please. I have spent two days trying to figure this out.
    I'm have WP 1.5.1.3, IE6 SP2, and Firefox.

    http://ronpemberton.com

    Thanks!
    Ron

  2. Jonathan Dingman
    Member
    Posted 9 years ago #

    If I understand you correctly, you're looking to add a stylesheet JUST for IE. If you are, you can do so by adding this in your header:

    <!--[if IE]>
    <link rel="stylesheet" type="text/css" href="iespecific.css" />
    <![endif]-->

  3. Ron Pemberton
    Member
    Posted 9 years ago #

    I have added this to my header.php already. In notpad++ it appears in green, ju st like when I add comments into my files. Why it appears this way I don't know. Do I need to add some sort of opening and closing tags for this?, like <script> and </script>?

    UPDATE: tried adding the opening and closing tags - it had no effect.

    What could keep this from working? I have even placed an absolute path to the file, and tried placing it in various locations around the header file.

  4. Try this:

    <?php if (eregi("MSIE",getenv("HTTP_USER_AGENT")) ||
    eregi("Internet Explorer",getenv("HTTP_USER_AGENT"))) { ?><link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_directory'); ?>/style-ie.css"/>
    <?php } else { ?>

    <link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_directory'); ?>/style.css"/>

    <?php } ?>

  5. Ron Pemberton
    Member
    Posted 9 years ago #

    Macmanx,
    i tried this and it isn't working. Where it says "style-ie.css" in your suggested script above i put the name of my ie file. This would be correct, right?
    I also have tried the javascript mentioned above. Something is keeping it from working. Whatever it is, it is keeping everything from working - javascript or php.

  6. Ron Pemberton
    Member
    Posted 9 years ago #

    I have pasted my header.php at this site:

    http://pastebin.com/309272

    Kubrick default theme WP1.5.1.3

  7. Ron Pemberton
    Member
    Posted 9 years ago #

    If anybody else has any input it would also be appreciated. Thanks!

  8. moshu
    Member
    Posted 9 years ago #

    Is this second stylesheet for the theme that's visible now on your blog? As far as I can see it's a default K. theme with a changed header image. The Default theme works perfectly across browsers.

  9. Ron Pemberton
    Member
    Posted 9 years ago #

    First, sorry it took so long to return a response to my own thread.
    Yes, it is the Kubrick default theme. But, the nav bar I built renders well in Firefox, but not IE. Now, being new to CSS, it is still out of my reach to juggle CSS in one file for two browsers. What I hoped to do was create an exact copy of my primary stylesheet that only IE would use. I could then more easily tweak until it renders things correctly in IE, without screwing up anything in other browsers. For some reason, I can't get the javascript tags to work. When I open the header.php in Notepad++, these tags appear in green, as if they are commented out. Just like actual comments appear. I have checked permissions on files, etc..
    Any help most appreciated. My header.php can still be found at the link in the above post.

  10. Ron Pemberton
    Member
    Posted 9 years ago #

    Ok, I checked the link above. Not there anymore. Pastebin.com must have a time limit. My eader.php has been resubmitted here.

    http://pastebin.com/310688

    Thanks for any help on this!

  11. bencostello
    Member
    Posted 9 years ago #

    ronaldp423,
    I too was having the same problem, needed a IE specific stylesheet and the code I was using was also comming up as a comment in Notepad++. I tried many things but I got it to work by using macmanx's code. The only alteration I made to my own code was to delete the line "<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />" because it is already in the code.
    So then I pasted macmanx's code in its place and what do you know it worked.
    Thanks a lot macmanx!
    -Ben

  12. wfx
    Member
    Posted 9 years ago #

    You have it worked but i want to say tha i also preffer
    "jdingman" way but you must use it like this:

    <!--[if IE]>
    <link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/IE.css" type="text/css" media="screen" />
    <![endif]-

    have fun.

  13. EvilJimi
    Member
    Posted 8 years ago #

    macmanx ... thanks! That's exactly what I needed and it works perfectly -- as far as I can tell, using Firefox 1.0.6, Opera 8.5 and IE6 on WinXP Pro.

  14. Nicki Faulk
    Member
    Posted 8 years ago #

    macmanx, you saved me once again. I've been working on a new theme that I created from scratch and silly IE was screwing up my alignment ... now I can have an altered view for my IE visitors (the poor souls, lol).

    Thank you!!! :)

Topic Closed

This topic has been closed to new replies.

About this Topic