Please explain in detail this part of YUI3 CSS Reset

旧时模样 提交于 2019-12-04 04:05:43

问题


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

回答1:


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:

body {
    font: 1.1em verdana, arial, sans-serif;
}

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 to inherit on those elements:

input, select, textarea {
    font: inherit;
}

But that doesn't work in IE6/7. Another way is to just explicitly include the elements in the rule:

body, input, select, textarea {
    font: 1.1em verdana, arial, sans-serif;
}

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 is sans-serif for input and select and is monospace for textarea). The 100% is been used because IE6/7 doesn't support inherit.

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?



来源:https://stackoverflow.com/questions/2879276/please-explain-in-detail-this-part-of-yui3-css-reset

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!