H1-H6 标签最常见的字体大小是什么

2022-01-19 00:00:00 frontend html css

我一直不确定从哪里开始作为一般最佳实践基准.是的,我知道这取决于您的设计,但最常见的是什么?

I've always been unsure of where to start as a general best practice baseline. Yes, I know it depends on your design, but what's most common?

这是我目前作为初学者所拥有的:

Here's what I currently have as a starter:

h1 { font-size: 24px;}
h2 { font-size: 22px;}
h3 { font-size: 18px;}
h4 { font-size: 16px;}
h5 { font-size: 12px;}
h6 { font-size: 10px;}

是的,我目前的工作不使用 EM.

Yes, we don't use EMs at my current job.

推荐答案

这取决于浏览器的默认样式表.您可以查看 CSS2.1 用户代理样式表默认值的(非官方)表 这里.

It would depend on the browser's default stylesheet. You can view an (unofficial) table of CSS2.1 User Agent stylesheet defaults here.

根据上面列出的页面,默认尺寸如下所示:

Based on the page listed above, the default sizes look something like this:

    IE7     IE8     FF2         FF3         Opera   Safari 3.1
H1  24pt    2em     32px        32px        32px    32px       
H2  18pt    1.5em   24px        24px        24px    24px
H3  13.55pt 1.17em  18.7333px   18.7167px   18px    19px
H4  n/a     n/a     n/a         n/a         n/a     n/a
H5  10pt    0.83em  13.2667px   13.2833px   13px    13px
H6  7.55pt  0.67em  10.7333px   10.7167px   10px    11px

如今,所有现代浏览器都有与默认值相同的值.

Nowadays, all modern browsers have the same values as defaults.

相关文章