css - 我如何在 Internet Explorer 中应用一个 css 属性

标签 css

.sample{
   height:15px;
   width:15px;
   margin:10px;
   padding:10px;
   float:left:

   /* this one apply in ie only */
   border:1px solid #fff;
   /* this one apply in ie only */
}

最佳答案

我建议使用完全独立的 IE 特定样式表,以隔离您使用的所有讨厌的 IE hack。然后,在您的 HTML 中,您可以使用条件注释来加载仅适用于 IE 的样式表。

HTML

<html>
    <head>
        <!--[if IE]>
            <link rel="stylesheet" type="text/css" href="/css/ie-hacks.css">
        <![endif]-->
    </head>
    <body>
        <!-- ... --->
    </body>
</html>

ie-hacks.css

.sample{
   border:1px solid #fff;
}

关于css - 我如何在 Internet Explorer 中应用一个 css 属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4165962/

相关文章:

jquery - CSS 第一个子选择器不适用于大多数元素

html - 哪些浏览器支持哪些 CSS 属性?

html - 在圆圈内垂直居中加号

javascript - 如何在 Google ColumnChart 中放置一个图标

javascript - 使用 javascript(或 jQuery)选择和操作 CSS 伪元素,例如::before 和::after

html - Bootstrap 模板未显示

javascript - 检查 'Input Field' 是否包含特定字母 E 或 B ...返回所需页面

html - 避免图像对象继承专用于文本格式化的样式

html - 将鼠标悬停在菜单项上会删除左边框。如何在悬停时保留菜单边框?

jquery - setInterval 和 setTimeout 在悬停时停止在一起