CSS font-size property
Examples
Set the font size of different HTML elements:
h1 {font-size:250%}
h2 {font-size:200%}
p {font-size:100%}
h2 {font-size:200%}
p {font-size:100%}
try it"
Attribute definitions and instructions
font-size property to set the font size.
Defaults: | medium |
---|---|
inherit: | yes |
version: | CSS1 |
JavaScript syntax: | object .style.fontSize = "larger" |
Browser Support
Figures in the table represent the first browser to support the version number of the property.
属性 | |||||
---|---|---|---|---|---|
font-size | 1.0 | 5.5 | 1.0 | 1.0 | 7.0 |
Property Value
value | description |
---|---|
| The font size is set to different sizes, from xx-small to xx-large. Default: medium. |
smaller | The font-size is set to less than the size of the parent element. |
larger | The font-size is set to a larger size than the parent element. |
length | The font-size is set to a fixed value. |
% | The font-size is set based on a percentage of the value of the parent element. |
inherit | Provisions should inherit the font size from the parent element. |
related articles
CSS tutorial: CSS the Font
CSS Reference: font properties