I always thought that body font and input font were separate. For example, if I have this for my HTML:
<div>some test text</div> <input type="text"/>
and then this for my CSS:
body {
font:2em verdana;
}
then only the div font is large and the input text stays small. But if I add this CSS:
input {
font-size:1em;
}
then the input font size takes on the body font size. why?
you’re right with your first sentence: input elements usually don’t inherit font-sizes.
with using
emthis doesn’t work anymore, because1emis, by definition, the font-size of an element – and if you set the font-size toem, it’s based on the parent-elements font-size, because the element itself doesn’t have an absolute font-size anymore.so using
font-size: 1emon inputs is basically kind of like usingfont-size: inheritfor inputs andpxfor the body-setting.