在IE7和IE8中使用多类选择器 [英] Using multiple-class selectors in IE7 and IE8
本文介绍了在IE7和IE8中使用多类选择器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道IE7& IE8应该支持使用多个CSS类选择器,但我似乎不能让它工作。
I know IE7 & IE8 supposedly have support for using multiple CSS class selectors, but I can't seem to get it to work.
CSS:
.column {
float: left;
display: block;
margin-right: 20px;
width: 60px;
}
.two.column {
width: 140px;
}
.three.column {
width: 220px;
}
.four.column {
width: 300px;
}
HTML:
<div class='two column'>Two Columns</div>
<div class='three column'>Three Columns</div>
<div class='four column'>Four Columns</div>
它总是最终使用 .four.column 规则。关于我做错了什么想法?
It always end up using the .four.column rule. Any ideas on what I'm doing wrong?
推荐答案
您要确保并使用文档类型,在怪异模式。例如:
You want to make sure and use a doc type so you do not render in quirks mode. For example:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test Page</title>
<style type="text/css">
.column {
float: left;
display: block;
margin-right: 20px;
width: 60px;
border: 1px solid;
}
.two.column {
width: 140px;
}
.three.column {
width: 220px;
}
.four.column {
width: 300px;
}
</style>
</head>
<body>
<div class="two column">Two Columns</div>
<div class="three column">Three Columns</div>
<div class="four column">Four Columns</div>
</body>
</html>
这篇关于在IE7和IE8中使用多类选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文