html5中article和p的区别?

html5中article和p的区别?,第1张

1、定义内容不同

<article>:定义外部的内容,代表文档、页面、应用程序中独立的完整的被外部引用的内容区域。它可以是博客中的文章、帖子、用户的回复,article它所表示的所展现的内容,是外表独立出来的内容,所以它有自己独立的标题、页脚。

<p>:段落标签

2、使用不同

<article>是可以嵌套使用的,内外层内容相关联,用户看到的内容并不是对应本网站的一个具体的页面。

<p>标签主要用作定义一段文本。p 元素会自动在其前后创建一些空白,浏览器会自动添加这些空间

扩展资料:

article元素的用法

<!DOCTYPE html>

<html>

<head lang=”en”>

<meta charset=”UTF-8”>

<titile></title>

</head>

<body>

<article>

</header>

<h1>我是Article</h1>

<p>创建时间:<time pubdate=”pabdate”>2014/09/27</time></p>

</header>

<p>

<b>Article</b>是一个独一的区域

</p>

<footer>

<p><small>麦子学院版权所有</small></p>

</footer>

</article>

</body>

</html>

可以用,但是不规范

因为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>


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/6170656.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-03-17
下一篇 2023-03-17

发表评论

登录后才能评论

评论列表(0条)

保存