设置不同元素的字体大小:
div.a {
font-size: 15px;
}
div.b {
font-size: large;
}
div.c {
font-size: 150%;
}
亲自试一试 »
这个font-size
属性设置字体的大小。
表中的数字指定完全支持该属性的第一个浏览器版本。
Property | |||||
---|---|---|---|---|---|
font-size | 1.0 | 5.5 | 1.0 | 1.0 | 7.0 |
font-size:medium|xx-small|x-small|small|large|x-large|xx-large|smaller|larger|
length|initial|inherit;
Value | Description | Demo |
---|---|---|
medium | Sets the font-size to a medium size. This is default | Demo ❯ |
xx-small | Sets the font-size to an xx-small size | Demo ❯ |
x-small | Sets the font-size to an extra small size | Demo ❯ |
small | Sets the font-size to a small size | Demo ❯ |
large | Sets the font-size to a large size | Demo ❯ |
x-large | Sets the font-size to an extra large size | Demo ❯ |
xx-large | Sets the font-size to an xx-large size | Demo ❯ |
smaller | Sets the font-size to a smaller size than the parent element | Demo ❯ |
larger | Sets the font-size to a larger size than the parent element | Demo ❯ |
length | Sets the font-size to a fixed size in px, cm, etc. Read about length units | Demo ❯ |
% | Sets the font-size to a percent of the parent element's font size | Demo ❯ |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
CSS教程:CSS 字体
CSS 参考:字体属性
HTML DOM 参考:字体大小属性
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!