fontSize 属性设置或返回文本的字体大小。
Property | |||||
---|---|---|---|---|---|
fontSize | Yes | Yes | Yes | Yes | Yes |
返回 fontSize 属性:
object.style.fontSize
设置字体大小属性:
object.style.fontSize
= "value|initial|inherit"
Value | Description |
---|---|
xx-small x-small small medium large x-large xx-large |
Sets the size of the font to different fixed sizes, from xx-small to xx-large |
smaller | Decreases the font-size by one relative unit |
larger | Increases the font-size by one relative unit |
length | Defines the font-size in length units |
% | Sets the font-size to a % of the parent element's font size |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
默认值: | 中等的 |
---|---|
返回值: | 一个字符串,表示元素中文本的字体大小 |
CSS版本 | CSS1 |
可能值的演示:
var listValue = selectTag.options[selectTag.selectedIndex].text;
document.getElementById("demo").style.fontSize = listValue;
亲自试一试 »
CSS教程:CSS 字体
CSS 参考:字体大小属性
HTML DOM 参考:字体属性
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!