html5boilerplate IE条件不工作 [英] html5boilerplate IE conditional not working

查看:105
本文介绍了html5boilerplate IE条件不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,这是我第一次使用html5boilerplate,但不能得到的IE样式工作从我的CSS文件。

Ok, this is the first time I am using html5boilerplate, but cant get the IE styles to work from my css file.

我在标题中有这个(根据页面设置)

I have this in the header (as per page setting)

<!doctype html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]>    <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]>    <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!-- Consider adding a manifest.appcache: h5bp.com/d/Offline -->
    <!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>

在我的样式表中,我有

#container { float:right; margin-top: 0px; }

.ie6 #container { margin-top: 5px; }

.ie7 #container { margin-top: 10px; }

.ie8 #container { margin-top: 15px; }

它不工作。是真的那么简单,我错过了一些东西。

and it doesnt work. Is it really that simple, am I missing something.

您的建议值得赞赏。

推荐答案

除非你使用一些javescript shiv,否则你应该使用实际定义的:

Unless you're using some javescript shiv, then you should be using what's actually defined:

html class =no-js lt-ie9 lt-ie8 lt-ie7

尝试,

#container { float:right; margin-top: 0px; }

.lt-ie7 #container { margin-top: 5px; }

.lt-ie8 #container { margin-top: 10px; }

.lt-ie9 #container { margin-top: 15px; }

这篇关于html5boilerplate IE条件不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆