Does the CSS font font "font-size: medium" set the font size to .Body or the font size * of the browser *?

in “CSS: the missing guide,” the author says that font-size: medium (or other keywords by size) sets the font relative to the browser’s base font size.

But what I see in FF2 and IE6 is that it sets the font size in what I specified in HTML or BODY.CSS style (which is very important).

If this works in the latter way, it is very convenient if you have nested styles and you know that you want some text to be the font size of the body (ie "normal text size").

+2
source share
5 answers

From CSS 2.1 specification :

"medium" .

, .

+5

, . , :

body {
   font: normal 100% "Arial","Helvetica",sans-serif;
}
p, li, td {
   font-size: .85em;
}
li p, td p {
   font-size: 1em;
}

100%, em . "" "" - . .

Edit:

, . , "" . .

+2

(xx-small, x-small, small, medium ..) , . .

0

, medium UA (), , rem. rem ( <html>, <body>) , , .

.

html
{
  font-size: 60px;
}

#mediumBlock
{
  font-size: medium;
}

#remBlock
{
  font-size: 1rem;
}

#halfRemBlock
{
  font-size: 0.5rem;
}
<div id="inheritedBlock">
  Foobar inherited
</div>
<div id="mediumBlock">
  Foobar medium
</div>
<div id="remBlock">
  Foobar rem
</div>
<div id="halfRemBlock">
  Foobar 0.5rem
</div>
Hide result
0

, , , . , ( ).

-1

All Articles