YUI 重置CSS中的这一行给我带来了麻烦:
address,caption,cite,code,dfn,em,strong,th,var {
font-style: normal;
font-weight: normal;
}
Run Code Online (Sandbox Code Playgroud)
它使我的em不是斜体,而strong不是我的大胆.哪个没关系.我知道如何在我自己的样式表中覆盖它.
strong, b
{
font-weight: bold;
}
em, i
{
font-style: italic;
}
Run Code Online (Sandbox Code Playgroud)
当我有两个em和两个文本时,问题就出现了strong.
<strong>This is bold, <em>and this is italic, but not bold</em></strong>
Run Code Online (Sandbox Code Playgroud)
我的规则strong是大胆的,但YUI的规则em使它再次正常.我该如何解决这个问题?
pal*_*sey 17
如果您的强烈声明是在YUI之后发出的,那么你应该覆盖它.你可以像这样强迫它:
strong, b, strong *, b * { font-weight: bold; }
em, i, em *, i * { font-style: italic; }
Run Code Online (Sandbox Code Playgroud)
如果你仍然支持IE7,你需要添加!important.
strong, b, strong *, b * { font-weight: bold !important; }
em, i, em *, i * { font-style: italic !important; }
Run Code Online (Sandbox Code Playgroud)
这有效 - 看看你自己:
/*YUI styles*/
address,caption,cite,code,dfn,em,strong,th,var {
font-style: normal;
font-weight: normal;
}
/*End YUI styles =*/
strong, b, strong *, b * {
font-weight: bold;
}
em, i, em *, i * {
font-style: italic;
}Run Code Online (Sandbox Code Playgroud)
<strong>Bold</strong> - <em>Italic</em> - <strong>Bold and <em>Italic</em></strong>Run Code Online (Sandbox Code Playgroud)
我会使用此规则来覆盖YUI重置:
strong, b, strong *, b *
{
font-weight: bold;
}
em, i, em *, i *
{
font-style: italic;
}
Run Code Online (Sandbox Code Playgroud)
如果除了使用YUI reset.css之外,还使用了YUI base.css,那么您将使用一组标准的跨浏览器基本样式进行设置.
链接:http://developer.yahoo.com/yui/base/
| 归档时间: |
|
| 查看次数: |
11040 次 |
| 最近记录: |