0

当您在 Google 上搜索“IE 单独样式表”之类的内容时,有很多阅读材料,但没有很多示例。

在我的主要样式之后,我有以下适用于 IE7 的条件 CSS。

我希望margin-top在 IE7 中更大。

<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
<!--[if IE 7]>
<link rel="stylesheet" href="<?php echo get_stylesheet_directory_uri(); ?>/ie7.css" media="screen" type="text/css" />
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" href="<?php echo get_stylesheet_directory_uri(); ?>/ie8.css" media="screen" type="text/css" />
<![endif]-->

在我的主样式表中,我有这个:

.outerBlue_s {
    width: 230px; 
    height: 260px;
    overflow: hidden;
    color: #FFF;
    border-radius: 10px;
    box-shadow: 5px 5px 2px #cccccc;
    -moz-box-shadow: 5px 5px 2px #cccccc;
    -webkit-box-shadow: 5px 5px 2px #cccccc;
    margin:0 auto;
    text-align:center;
    font-size:18px;
    vertical-align:middle;

在 IE 样式表中,我只放置了所需的边距:

.outerBlue_s {
    margin-top:50px;
}

尽管如此,当我检查 IE7 时,边距并没有改变。

任何帮助和建议表示赞赏。

<link rel="stylesheet" type="text/css" media="all" href="http://fafaradesigns.com/wp/wp-content/themes/fafaradesigns/style.css" />
<!--[if IE 7]>
<link rel="stylesheet" href="http://fafaradesigns.com/wp/wp-content/themes/fafaradesigns/ie7.css" media="screen" type="text/css" />
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" href="http://fafaradesigns.com/wp/wp-content/themes/fafaradesigns/ie8.css" media="screen" type="text/css" />
<![endif]--> 

看起来没有引用 ie7 工作表。我究竟做错了什么?

我最终通过在每个单独的页面上内联条件样式来进行黑客攻击:

<!--[if lt IE 8]>
<style>
.innerBlue_c  {
margin-top: 1.5em;
}
</style>

我宁愿使用外部单独的 ie 样式表,这样代码就更干净了——但我不知道为什么它不起作用。条件语句看起来错了吗?

4

1 回答 1

0

更新:我终于使用 Monderizr 和我最初列出的相同条件代码加载了外部样式表。似乎我所要做的就是在外部工作表的样式前面添加一个 .ie7 。

有效的代码示例:

.ie7 #nav li {
    z-index: 102;
}
于 2013-07-09T20:08:37.610 回答