css怎么设置字号

html-css014

css怎么设置字号,第1张

第一种:.pt{font-size:24pt}

第二种:

<p style="font-size:xx-small">关键字为xx-small。</p>

<p style="font-size:x-small">关键字为x-small。</p>

<p style="font-size:smaller">关键字为smaller。表示相对尺寸。</p>

<p style="font-size:small">关键字为small。</p>

<p style="font-size:medium">关键字为medium。这是浏览器默认的字号。</p>

<p style="font-size:large">关键字为large。</p>

<p style="font-size:larger">关键字为larger。表示相对尺寸。</p>

<p style="font-size:x-large">关键字为x-large。</p>

<p style="font-size:xx-large">关键字为xx-large。</p>

可以使用font属性来设置字体,它的参数比较多,可以参考其schema约束来写。

常用的格式是 font: font-style font-weight font-size/line-height  "font-family","font-family"

含义:font: 字体样式 加粗大小 字号/行高 "字体名称1","字体名称2"

如:

/*font:  15px/25px "microsoft Yahei","SimSun"*/   /* 部分属性可采用默认 */

font: oblique 500 15px/25px "microsoft Yahei","SimSun"

就代表 字体是倾斜、加粗值500、字号15/行高25 ,首选字体microsoft yahei(微软雅黑),如果用户电脑没有该字体,则使用SimSun(宋体);

----------------------------------------------------------

如果只是单纯的设置字体,可以使用font-family,如:

font-family: "microsoft yahei","SimSun"

修改文字大小的样式是font-size,后面写上你想要文字大小的数值,单位一般是px,例如20px这样。

举个例子:

<span style="font-size: 20px">字体大小</span>

以上为行内式的写法。