Create CSS for Internet Explorer Only

后端 未结 4 944
情书的邮戳
情书的邮戳 2020-12-12 01:39

I spent a good amount of time making a website look good, working with Google Chrome and Firefox, however as is often the case, when I look at it in Internet Explorer it loo

相关标签:
4条回答
  • 2020-12-12 01:47

    Your are looking for Conditional stylesheets vs. CSS hacks and one I had to dig out from the very bottom: PIE CSS3 decorations for IExplorer.

    0 讨论(0)
  • 2020-12-12 01:53

    Internet Explorer 9 and higher versions support border-radius. Lower versions do not support this. You can

    • use images
    • Ignore Internet Explorer 8 and below
    • use jquery plugin http://jquery.malsup.com/corner/
    0 讨论(0)
  • 2020-12-12 02:04

    IE-specific CSS:

    1. Use Modernizr to determine which features are available in the user's browser. This will add classes to the <body> tag, which you can then reference in your stylesheet, to activate certain styles if a given feature is or isn't there.

    2. Use Conditional comments to include an IE-specific stylesheet.

    3. Use an IE CSS hack, like the ones described here: http://net.tutsplus.com/tutorials/html-css-techniques/quick-tip-how-to-target-ie6-ie7-and-ie8-uniquely-with-4-characters/

    Border radius:

    This is supported by IE9, so you must be using IE8 or earlier (or a compatibility mode).

    1. Ignore it for uses of older IEs. It's not worth the effort to support them for a feature that doesn't actually affect the usability of the site.

    2. Use CSS3Pie to hack in the border-radius feature into IE. It's a hack, but it works quite well (better than some others that are being recommended here).

    0 讨论(0)
  • 2020-12-12 02:06

    Answer to your first question: to include a stylesheet file in IE only, wrap your <link>ing with a conditional comment. Here's an example on how to do it:

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

    Answer to your second question older versions of IE do not support border-radius. IE9 does support it, though. There's no workaround other than to use images or third-party plugins like jQuery corner.

    0 讨论(0)
提交回复
热议问题