【发布时间】:2017-03-01 12:34:41
【问题描述】:
所以我开始为学校作业编写 HTML 代码。我想使用 HTML5 语义,例如 <section>、<article> 等。但是当我放置在这些标签中时,我遇到了一些关于标题大小的特殊情况(见下文)。然后我继续将语义更改回只有 HTML,即只有 <div>,并且标题工作正常。我将发布一些屏幕截图以帮助澄清情况。
首先是带有<div>标签的代码
<!DOCTYPE html>
<html>
<head>
<title>
Curriculum Vitae
</title>
</head>
<body>
<div>
<h1>Curriculum Vitae</h1>
</div>
<div>
<h2>Personal Information</h2>
<ul>
<ol><strong>Name: </strong>Haroon Rasheed Ramay</ol>
</ul>
</div>
</body>
</html>
The heading sizes appear to work properly within in the div tags
接下来是使用 HTML5 语义的代码
<!DOCTYPE html>
<html>
<header>
<title>
Curriculum Vitae
</title>
</header>
<body>
<article>
<section>
<h1>Curriculum Vitae</h1>
</section>
<section>
<h2>Personal Information</h2>
<ul>
<ol><strong>Name: </strong>Haroon Rasheed Ramay</ol>
</ul>
</section>
</article>
</body>
</html>
请其他人验证这似乎只是我的问题,还是我以完全错误的方式使用 HTML5 语义标签导致标题的特殊行为?
附:任何 HTML 文档或教程的链接都很棒(目前我正在在线学习 udacity 和 w33schools 的课程以及在学校作为一门学科)
【问题讨论】:
标签: html semantics html-heading