为什么<section>没有在大纲中创建新的部分

时间:2016-11-21 21:43:14

标签: html html5

我自己在HTML5中学习大纲。

这是我的代码:

&#13;
&#13;
<html>
<head>
	<title>Home</title>
</head>
<body>	
	<header>
		<h1>Site Header</h1>
	</header>
	<section>
		<h1>Site Content</h1>
	</section>
	<footer>
		<h1>Site Footer</h1>
	</footer>
</body>
</html>
&#13;
&#13;
&#13;

大纲显示:

  1. 网站标题
    1. 网站内容
  2. 网站页脚
  3. 我的问题是:为什么我的<section>位于<header>(在大纲中)?我已经读过<header><section><footer>是分段元素,所以我的<section>应该在大纲中创建一个新的部分,对吧?但为什么在另一个部分?

1 个答案:

答案 0 :(得分:-1)

尝试使用简单的div?它的工作原理同样简单。

<div class="whatever">

</div>

CSS访问

.whatever {
   text-align: center; // Whatever
   width: 200px; // Whatever
}