css中设置字体大小的属性

html-css043

css中设置字体大小的属性,第1张

css中一般是用font-size来设置字体大小。

示例:

<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>css字号设置</title>

<style>

div{font-size:16px}

p{font-size:18px}

h2{font-size:20px}

</style>

</head>

<body>

<div>16号字体<div>

<p>18号字体</p>

<h2>20号字体(h2自带字体属性)</h2>

</body>

</html>

第一种:.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>