好的,这是我第一次使用html5boilerplate,但是不能从我的css文件中获取IE样式。
我在页眉中有这个(根据页面设置)
<!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; }但它不起作用。是不是真的那么简单,我错过了什么吗。
非常感谢您的建议。
发布于 2012-06-07 01:59:59
除非你使用的是javescript shiv,否则你应该使用实际定义的东西:
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; }发布于 2012-06-07 02:02:08
CSS类名称不匹配。例如,条件注释中的lt-ie8和样式表中的ie8。
我用过的一个版本是:
<!--[if lt IE 7 ]> <html class="no-js ie ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]> <html class="no-js ie ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]> <html class="no-js ie ie8" lang="en"> <![endif]-->
<!--[if IE 9 ]> <html class="no-js ie ie9" lang="en"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html class="no-js" lang="en"> <!--<![endif]-->与CSS规则结合使用,如:
.ie6 #container {...}
.ie7 #container {...}
.ie8 #container {...}发布于 2012-06-07 02:02:53
我在这些条件语句中看到了名为"lt-ie7“、"lt-ie8”和"lt-ie9“的类,但在您的CSS中,我看到您使用的是名为"ie6”、"ie7“和"ie8”的类,它们是不同的。尝试:
#container { float:right; margin-top: 0px; }
.lt-ie7 #container { margin-top: 5px; }
.lt-ie8 #container { margin-top: 10px; }
.lt-ie9 #container { margin-top: 15px; }https://stackoverflow.com/questions/10919480
复制相似问题