Is it proper to place code, or content between the HTML lt;/headgt; and lt;bodygt; tags(在 HTML lt;/headgt; 之间放置代码或内容是否合适?和lt;身体gt;标签)
问题描述
是否可以将 HTML 代码放在头部区域的结尾和正文区域的开头之间.我以前在各个站点上都这样做过,没有任何问题,但是,我想知道这是否有任何向后兼容性问题,以及这是否常见或良好的做法.例如:
Is it okay to place HTML code between the ending of the head area and before the beginning of the body area. I have done this before, on various sites without any problems, however, I would like to know whether this has any backwards compatibility issues, and also whether this is common, or good practice. For example:
</head>
<div id="header">
<h1>Heading</h1>
Code & Content...
</div><!-- #header -->
<body>
Code & Content...
</body>
推荐答案
不行,不行.页面的所有内容都应该放在 <body>
中.检查 HTML 规范.浏览器真的很宽容,但即使它有效,你也不应该这样做.
No, is not okay. All the content of the page should go inside <body>
. Check the HTML specification.
Browsers are really forgiving, but even if it works you shouldn't do it.
这篇关于在 HTML </head> 之间放置代码或内容是否合适?和<身体>标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 HTML </head> 之间放置代码或内容是否


- 为什么我的页面无法在 Github 上加载? 2022-01-01
- 如何调试 CSS/Javascript 悬停问题 2022-01-01
- 我不能使用 json 使用 react 向我的 web api 发出 Post 请求 2022-01-01
- 如何显示带有换行符的文本标签? 2022-01-01
- 是否可以将标志传递给 Gulp 以使其以不同的方式 2022-01-01
- 在不使用循环的情况下查找数字数组中的一项 2022-01-01
- 为什么悬停在委托事件处理程序中不起作用? 2022-01-01
- 使用 iframe URL 的 jQuery UI 对话框 2022-01-01
- 从原点悬停时触发 translateY() 2022-01-01
- 如何向 ipc 渲染器发送添加回调 2022-01-01