html5 p标签内能不能有table

html-css010

html5 p标签内能不能有table,第1张

可以用,但是不规范

因为p标签属于控制内容的

table标签属于控制结构的,一般不建议这样使用,你可换成p标签

最后建议不要用table布局,不利于优化,不利于搜索引擎抓取信息

标准格式如下:

<!DOCTYPE HTML>

<html>

<head>

<meta http-equiv="Content-Type" content="text/htmlcharset=UTF-8" />

<title>Your Website</title>

</head>

<body>

<header>

<nav>

<ul>

<li>Your menu</li>

</ul>

</nav>

</header>

<section>

<article>

<header>

<h2>Article title</h2>

<p>Posted on <time datetime="2009-09-04T16:31:24+02:00">September 4th 2009</time>by <a href="#">Writer</a>- <a href="#comments">6 comments</a></p>

</header>

<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>

</article>

<article>

<header>

<h2>Article title</h2>

<p>Posted on <time datetime="2009-09-04T16:31:24+02:00">September 4th 2009</time>by <a href="#">Writer</a>- <a href="#comments">6 comments</a></p>

</header>

<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>

</article>

</section>

<aside>

<h2>About section</h2>

<p>Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>

</aside>

<footer>

<p>Copyright 2009 Your name</p>

</footer>

</body>

</html>

html 和 html5的区别如下:

1. 文件类型声明

5: <!DOCTYPE HTML>

4: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">

2. 编码设置

<meta charset="UTF-8">

<meta http-equiv="Content-Type" content="text/htmlcharset=UTF-8">

3. 可以直接嵌入MathML和SVG

4. 新的解析规范

5. 移除一些无用的标签

big, center, font, acronym, applet, basefont, dir, frame, frameset, isindex, noframes, strike, tt

html5与html在新元素方面的区别:

一、更好的结构化、语义化,引入下面这些元素

section 代表一个通用的文件或应用部分。它可以和 h1, h2, h3, h4, h5, 及 h6 元素同时使用来表明文档的结构。

article代表了一个文档内容的独立片段,比如博客条目或报纸文章。

Aside 代表了一段与页面的其余部分稍稍相关的内容。

hgroup 代表一个部分(section)的头(header)。

header代表一组介绍或导航辅助。

footer 代表一个部分(section)的尾(footer)并可以容纳关于作者、版权等信息。

nav 代表了用于导航目的的文档的一部分。

figure 代表一个独立的流内容片段,通常作为一个文档主流的独立单元。

<figure>

<video src="example.webm" controls></video>

<figcaption>Example</figcaption>

</figure>

figcaption 被用作标题 (它是可选的).