2012-02-01 55 views
1

我删除了很多文本,按钮等,所以这个html页面看起来很简单。我仍然不明白,为什么IE6.0不显示文字“在IE6.0中不粗体,为什么?”大胆? 谢谢。输入文字在Chrome,FF,Opera中为粗体,但不在IE6.0中。为什么?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html> 
<head> 
<title>Test</title> 
<style> 
input[type='text'], input[type='password'], input[type='button'], input[type='submit'], input[type='file'], textarea { 
    font-size:16px; 
    font-weight:bold; 
} 
</style> 
</head> 
<body> 
<input style="font-size:16px; font-weight:bold;" value="bold" type="text"> 
<input type="text" value="not bold in IE6.0. Why?"> 
</body></html> 

回答

4

IE6不支持属性选择器。

/* So, this would work in IE6: */ 
input { font-weight: bold; } 

/* But IE6 won’t understand this: */ 
input[type="text"] { font-weight: bold; } 

/* If you combine the two, IE6 still won’t understand it! 
    It will drop the entire rule set, and it won’t apply any of its styles. 
*/ 
input, input[type="text"] { font-weight: bold; } 
+1

+1。这就是http://www.ie6countdown.com/存在的原因。 ;) – 2012-02-01 09:00:31

+0

你会推荐忘记这个问题吗?它仅用于输入类型文本中的字体。有多少人使用IE6.0-?不到2%,而其他字体并不重要......我刚刚搜索了它,但我仍然不知道如何修复它。谢谢。 Ooops,对于2012年1月3日的评论,似乎只有2%多于2%。 – Haradzieniec 2012-02-01 09:01:45

+2

@Haradzieniec根据情况,您可能会使用'input {font-weight:bold; }'。如果没有,我认为IE6用户不会得到粗体文本是一件大事。 – 2012-02-01 09:09:50

相关问题