css 字号px跟%有什么区别啊? 比如说12px跟120%

html-css014

css 字号px跟%有什么区别啊? 比如说12px跟120%,第1张

px和pt都是绝对单位,%是相对打下,比如<table width=50%>表示宽度为所在容器的一半,如果直接在<body>里面,这个表格的宽度就是窗口大小的一半,而<table width=400pt>这个表格的宽度固定为400像素。

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