html - HTML5 中的主要标签是什么?它与 body 标签有何不同?

标签 html

这个问题在这里已经有了答案:





Purpose of the HTML5 main element

(3 个回答)


1年前关闭。




我对 main 有很多困惑HTML 的标签。它描述了页面的内容,body 也是如此。 .应该只有一个main页面中的标签。 body标签也应该在 HTML 中出现一次。这两个标签有什么区别? main 之间可以嵌套哪些元素标签,哪个不能?这个标签如何改变流动内容和明显内容的本质?

最佳答案

主体和主体的区别:
主要 :

The content inside the main element should be unique to the document. It should not contain any content that is repeated across documents such as sidebars, navigation links, copyright information, site logos, and search forms.


正文 :

The body element contains all the contents of an HTML document, such as text, hyperlinks, images, tables, lists, etc.


一个简单的例子,页脚元素;您应该将它放在主体内部,但在主体外部,就像您对菜单或侧边栏所做的那样。

关于html - HTML5 中的主要标签是什么?它与 body 标签有何不同?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56803764/

相关文章:

html - 依次放置几个div width full width 并调整图像背景的宽度和高度

php - 在我的网站内实现地址栏

html - 在 laravel 的 html 中添加表单操作

html - 如何设置从浏览器下载的文件名?

javascript - HTML 视觉对象无法正确呈现

javascript - 设置html时验证

javascript - HTML - 长表单上的多选窃取 dom 滚动

html - 使用背景 url 在不拉伸(stretch)的情况下将整个图像定位在 div 元素中

html - 对齐一个盒子,在底部而不是顶部

html - 当用户放置鼠标悬停链接时图像发生变化