css中设置字体大小的属性

html-css024

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>

可以查看他的源代码,或者使用其他工具查看,如google chrome的开发者工具(按F12)、FF的firebug工具。

如google开发者工具,找到想要查看的地方,点右键,点“审查元素”