test
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • olejenya Friend
    #188968

    Greetings. My site in ie8 does not appear as it should. I would like to add a separate css for IE8. How to do it. And just one more question, how do I connect an additional Customise css created by me in this topic? For example Dark theme, and in it I want to create a dark.css that would styles were only Dark, and the compiler of loess did not interrupt?

    TomC Moderator
    #499087

    The best method, by far, is the CONDITIONAL CLASSES technique. Here’s how you do it:


    <!--> <html class="ie7"> <!-->
    <!--> <html class="ie8"> <!-->
    <!--> <html class="ie9"> <!-->
    <!--><!--> <html> <!--<!-->

    This uses conditional comments to target certain versions of Internet Explorer, and the <html> element receives a custom class name for different versions of IE, and no class name when the browser is not IE.

    Then in your CSS, you would target IE7 or IE8 like this:


    .element {
    margin-bottom: 20px;
    }

    .ie7 .element {
    margin-bottom: 10px;
    }

    .ie8 .element {
    margin-bottom: 15px;
    }

    Every browser will have a bottom margin of 20px on the element in question, but IE7 and IE8 will have a bottom margin of 10px and 15px respectively.

    It’s important to note here that although targeting IE is necessary at times, it is strongly suggested that you try to find a better way to fix any browser differences, and avoid using conditional classes or any of the hacks mentioned below, if at all possible. Sometimes you just need to rethink your CSS and possibly your markup, and you can avoid this extra code from the start.

    TomC Moderator
    #499089

    Another method is to use CONDITIONAL STYLESHEETS

    Why use conditional stylesheets?? . . .

    • You’ve got IE related problems that need to be fixed
    • Keeps your code hack-free and valid
    • Keeps your main stylesheet clean
    • Perfectly acceptable technique, sanctioned by Microsoft

    These conditional tags don’t have to be used only for CSS. You could load JavaScript, or even use them down in the content of your site to display special IE-specific messages.

    CONDITIONAL STYLESHEET CODE:
    This would go in your <head> with all the other regular CSS <link>ed CSS files. The opening and closing tags should be familiar, that’s just regular ol’ HTML comments. Then between the brackets, “IF” and “IE” should be fairly obvious. The syntax to note is “!” stand for “not”, so !IE means “not IE”. gt means “greater than”, gte means “greater than or equal”, lt means “less than”, lte means “less than or equal.”

    Target ALL VERSIONS of IE:


    <!-->
    <link rel="stylesheet" type="text/css" href="all-ie-only.css" />
    <!-->

    Target everything EXCEPT IE:


    <!--><!-->
    <link rel="stylesheet" type="text/css" href="not-ie.css" />
    <!--<!-->

    Target IE 7 ONLY:


    <!-->
    <link rel="stylesheet" type="text/css" href="ie7.css">
    <!-->

    Target IE 6 ONLY:


    <!-->
    <link rel="stylesheet" type="text/css" href="ie6.css" />
    <!-->

    Target IE 5 ONLY:


    <!-->
    <link rel="stylesheet" type="text/css" href="ie5.css" />
    <!-->

    Target IE 5.5 ONLY:


    <!-->
    <link rel="stylesheet" type="text/css" href="ie55.css" />
    <!-->

    Target IE 6 and LOWER:


    <!-->
    <link rel="stylesheet" type="text/css" href="ie6-and-down.css" />
    <!-->

    <!-->
    <link rel="stylesheet" type="text/css" href="ie6-and-down.css" />
    <!-->

    Target IE 7 and LOWER:


    <!-->
    <link rel="stylesheet" type="text/css" href="ie7-and-down.css" />
    <!-->

    <!-->
    <link rel="stylesheet" type="text/css" href="ie7-and-down.css" />
    <!-->

    Target IE 8 and LOWER:


    <!-->
    <link rel="stylesheet" type="text/css" href="ie8-and-down.css" />
    <!-->

    <!-->
    <link rel="stylesheet" type="text/css" href="ie8-and-down.css" />
    <!-->

    Target IE 6 and HIGHER:


    <!-->
    <link rel="stylesheet" type="text/css" href="ie6-and-up.css" />
    <!-->

    <!-->
    <link rel="stylesheet" type="text/css" href="ie6-and-up.css" />
    <!-->

    Target IE 7 and HIGHER:


    <!-->
    <link rel="stylesheet" type="text/css" href="ie7-and-up.css" />
    <!-->

    <!-->
    <link rel="stylesheet" type="text/css" href="ie7-and-up.css" />
    <!-->

    Target IE 8 and HIGHER:


    <!-->
    <link rel="stylesheet" type="text/css" href="ie8-and-up.css" />
    <!-->

    <!-->
    <link rel="stylesheet" type="text/css" href="ie8-and-up.css" />
    <!-->

Viewing 3 posts - 1 through 3 (of 3 total)

This topic contains 3 replies, has 2 voices, and was last updated by  TomC 11 years, 4 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum