YUI的重置CSS 中的此行对我造成了麻烦:
地址,字幕,引用,代码,dfn,em,strong,th,var {字体样式:正常; font-weight:normal; }它使我的 em 不是斜体和我的强不是粗体。这是好的。我知道如何在我自己的样式表中覆盖它。
strong,b { font-weight:bold; } em,i { font-style:italic; }问题出现在我有文本 em 和 strong 。
这是粗体,< em>,这是斜体,但不是粗体< / em> / strong>我的规则 strong 但是YUI的 em 规则使它再次正常。如何解决这个问题?
解决方案如果你的强宣言来自YUI,你的应该重写它。你可以这样强制:
strong,b,strong *,b * {font-weight:bold; } em,i,em *,i * {font-style:italic; }如果您仍然支持IE7,您需要添加!important 。
strong,b,strong *,b * {font-weight:bold!important; } em,i,em *,i * {font-style:italic!important; }这项工作 - 自己看:
/ * YUI styles * / address,caption,cite,code,dfn,em,strong,th,var {font-style:正常; font-style:font-style:font-style:font-style:font-style:font-style:font-style:font-style:font-style: / code>
< strong>粗体< / strong> - < em>斜体< / em> - < strong> Bold和< em>斜体< / strong>
b
This line in YUI's Reset CSS is causing trouble for me:
address,caption,cite,code,dfn,em,strong,th,var { font-style: normal; font-weight: normal; }It makes my em not italic and my strong not bold. Which is okay. I know how to override that in my own stylesheet.
strong, b { font-weight: bold; } em, i { font-style: italic; }The problem comes in when I have text that's both em and strong.
<strong>This is bold, <em>and this is italic, but not bold</em></strong>My rule for strong makes it bold, but YUI's rule for em makes it normal again. How do I fix that?
解决方案If your strong declaration comes after YUI's yours should override it. You can force it like this:
strong, b, strong *, b * { font-weight: bold; } em, i, em *, i * { font-style: italic; }If you still support IE7 you'll need to add !important.
strong, b, strong *, b * { font-weight: bold !important; } em, i, em *, i * { font-style: italic !important; }This works - see for yourself:
/*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; }<strong>Bold</strong> - <em>Italic</em> - <strong>Bold and <em>Italic</em></strong>
更多推荐
YUI重置CSS使< strong>< em>这不工作< / em>&
发布评论