css怎么设置字号

html-css011

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>

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>

写两套css,你这个基本可以用两个图片搞定,一般一个网页呈现出来根据你浏览器的宽度来显示,你可以设定,当浏览器宽度大于1400的时候用文字多的,当小于1400的时候用文字少的,这也就是适配的问题,css3的@media属性就可以解决这个问题