Results 1 to 5 of 5

Thread: How to target IE only

  1. #1
    Join Date
    Mar 2012
    Posts
    53
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default How to target IE only

    Hi,
    I want to use this gradient background only for IE

    Code:
    background: #4f4f4f;
    background: -moz-radial-gradient(center, ellipse cover, #4f4f4f 0%, #0e0e0e 100%);
    background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%,#4f4f4f), color-stop(100%,#0e0e0e));
    background: -webkit-radial-gradient(center, ellipse cover, #4f4f4f 0%,#0e0e0e 100%);
    background: -o-radial-gradient(center, ellipse cover, #4f4f4f 0%,#0e0e0e 100%);
    background: -ms-radial-gradient(center, ellipse cover, #4f4f4f 0%,#0e0e0e 100%);
    background: radial-gradient(center, ellipse cover, #4f4f4f 0%,#0e0e0e 100%);
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#4f4f4f', endColorstr='#0e0e0e',GradientType=1 );
    there are methods that are for style sheet I don't want to use them as I want IE to use all the css that is for all browsers only that IE don't read the part of the gradient I want it to use the gradient above instead.
    How can this be done?

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Use "Internet Explorer conditional comments" (search Google for more info).
    You might need to put the whole <style> tag in the comment.

    Alternatively, you might not need to do anything-- it looks like you're using IE-only "filter", some "webkit" properties, and some "moz" properties. Also "ms" (microsoft?). So that should apply on those specific browsers.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Mar 2012
    Posts
    53
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by djr33 View Post
    Use "Internet Explorer conditional comments" (search Google for more info).
    You might need to put the whole <style> tag in the comment.

    Alternatively, you might not need to do anything-- it looks like you're using IE-only "filter", some "webkit" properties, and some "moz" properties. Also "ms" (microsoft?). So that should apply on those specific browsers.
    I first searched google before coming here :P It was only showing how to completely write a new style sheet for IE while I only want a background to be changed.
    And no this is not for IE or other, I am using radial gradient at the moment which in IE looks like a horizontal gradient which would have been okay but there is a problem that It creates the white part of gradient stays on left while I want it on right, that's why instead of IE using the radial gradient I want it to use the one that I have added above it is a horizontal one with white side on right as I want ^^

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    I don't know of a way other than using a special IE stylesheet. That's pretty common.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  5. #5
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 517 Times in 503 Posts
    Blog Entries
    5

    Default

    IE ignores most of the rules you posted.
    Code:
    /* this works in NO current browsers (IE10 will support it) */
    background: -ms-radial-gradient(center, ellipse cover, #4f4f4f 0%,#0e0e0e 100%);
    /* this works in CURRENT versions of IE. */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#4f4f4f', endColorstr='#0e0e0e',GradientType=1 );
    Just put these two rules after all the other rules in your regular stylesheet.

    IE will use them; all other browsers will ignore them.

Tags for this Thread

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
  •