【问题标题】:Input text is bold in Chrome, FF, Opera, but not in IE6.0. Why?输入文本在 Chrome、FF、Opera 中是粗体,但在 IE6.0 中不是。为什么?
【发布时间】:2012-02-01 08:51:18
【问题描述】:

我删除了很多文本、按钮等,所以这个 html 页面看起来很简单。我还是不明白,为什么IE6.0不显示文字“在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>

【问题讨论】:

    标签: css internet-explorer text input cross-browser


    【解决方案1】:

    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; }
    

    【讨论】:

    • 你会建议忘记这个问题吗?它仅适用于输入类型文本中的字体。有多少人用IE6.0-?不到 2%,其他字体也不是很重要……我刚刚用谷歌搜索过,但我仍然不知道如何修复它。谢谢你。糟糕,关于 2012 年 1 月 3 日...的评论,似乎是 2% 的几倍。
    • @Haradzieniec 根据具体情况,您可能会使用input { font-weight: bold; }。如果不是,我认为 IE6 用户不会看到粗体文本没什么大不了的。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-25
    • 1970-01-01
    • 1970-01-01
    • 2018-04-12
    • 2013-08-26
    相关资源
    最近更新 更多