YUI重置CSS使< strong>< em>这不工作< / em>< / strong&gt

编程入门 行业动态 更新时间:2024-10-27 08:40:16
本文介绍了YUI重置CSS使< strong>< em>这不工作< / em>< / strong>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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使&lt; strong&gt;&lt; em&gt;这不工作&lt; / em&gt;&

本文发布于:2023-09-12 06:29:06,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1466871.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:这不   工作   amp   CSS   YUI

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!