html 标记:多个/重复 html、head、body 标记等 - 后果

发布于 2024-10-22 19:03:10 字数 534 浏览 7 评论 0原文

我正在与一个团队一起开发一个网站项目。他们开始编写代码,对我来说似乎很混乱。 我们将 php 包含在页面的某些部分中。

例如,在 index.php 部分,我们有:

,在这里面,我们还有:

`<?php include("pages/submenus/commercial.sbm");?>`

里面,header.tpl是菜单栏, Commercial.sbm 内部是弹出的悬停子菜单项。

问题是,在这 3 个文件中,我们有 、、、

,所以这些标签现在被在一页中重复 - 例如。当我查看源代码 index.php 时

,我知道这不是有效的 HTML 标记,对吧?

我的问题是,使用这种代码/ html 标记会产生什么结果。

谢谢!

I'm working on a website project w/ a team. And they started the code, it seems messy for me.
we're having php includes for some sections of a page.

e.g. in the part of index.php we have:

<?php include("pages/header.tpl");?>, and inside this, we also have:

`<?php include("pages/submenus/commercial.sbm");?>`

inside, header.tpl are the menu bar,
and inside commercial.sbm are the pop-up hover submenu items.

The thing is, in these 3 files, we have <html>, <head>, <body>, <script>,<style> tags

so, these tags now are being repeated in one page -eg. when i view source index.php

I know this is not a valid HTML mark-up right?

My question is, what would be the outcomes having this kind of code/ html markup.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

迷离° 2024-10-29 19:03:10

这实际上取决于您使用的浏览器以及它如何解析文件。如果您使用 chrome、safari 或 firefox(通过 firebug)中的开发人员工具,您可以看到解析的最终结果。实现 HTML 5 解析器算法的浏览器应该对格式错误的标记(例如重复的 head 和 html 标记)给出相同的结果,但仍然有许多浏览器没有这样做。

最好的选择实际上只是修复错误的标记。

This really depends on which browser you're using and how it parses the file. If you use the developer tools in chrome, safari, or firefox (via firebug), you can see the end result of the parse. Browsers that implement the HTML 5 parser algorithm should all give the same result for malformed markup such as duplicate head and html tags, but there are still many browsers in use that don't.

The best option is really just to fix the bad markup.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文