请详细解释一下YUI3 CSS Reset的这一部分
CSS重置中这两件事有什么用处?
在 IE 中调整输入元素大小时出现什么问题以及在哪个版本中?
如果图例颜色没有在 IE 中继承,那么如何解决添加 color:#000;
/*to enable resizing for IE*/
input,
textarea,
select {
*font-size:100%;
}
/*because legend doesn't inherit in IE */
legend {
color:#000;
}
What is the usefulness of these 2 things in CSS reset?
What is the problem in resizing of input elements in IE and in which version?
and if legend color doesn't inherit in IE then how it can be solved adding color:#000;
/*to enable resizing for IE*/
input,
textarea,
select {
*font-size:100%;
}
/*because legend doesn't inherit in IE */
legend {
color:#000;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
第一条规则实际上不仅仅适用于 IE,而是适用于所有网络浏览器。通常,您希望在
body
中定义全局字体:但这不会应用于(继承)所有中的表单控件网络浏览器。然后,该规则也将(仅)应用字体大小。一种方法是将这些元素的
font
设置为inherit
:但这在 IE6/7 中不起作用。另一种方法是在规则中明确包含元素:
仅设置
font-size
可能是因为 YUI 人员希望保留表单控件自己的浏览器默认字体系列(对于input
和select
是sans-serif
,对于textarea
是monospace
) 。使用100%
是因为IE6/7不支持继承
。至于第二条规则:我不确定他们在这里的意思。我在IE6/7下做了一个小测试。
legend
只是从其父元素继承颜色。也许真正的问题出在其他地方?The first rule actually doesn't apply on IE only, but on all webbrowsers. Normally you would like to define a global font in the
body
:But this doesn't get applied (inherited) on the form controls in all webbrowsers. That rule would then apply (only) the font size on them as well. One way is to set the
font
toinherit
on those elements:But that doesn't work in IE6/7. Another way is to just explicitly include the elements in the rule:
That only the
font-size
is been set is probably because the YUI guys would like to keep the form controls their own browser-default font family (which issans-serif
forinput
andselect
and ismonospace
fortextarea
). The100%
is been used because IE6/7 doesn't supportinherit
.As to the second rule: I am not sure what they meant here. I did a little test in IE6/7. The
legend
just inherits the color from its parent element. Maybe the actual problem lies somewhere else?