包含超级凌乱的基于表格的 HTML 布局
我正在尝试将页脚添加到具有大量嵌套表格的基于表格的 HTML 布局。结构看起来像这样:
<head>
</head>
<body>
<form>
bloody mess of <table><tr><td> tags
</form>
--- div footer to go here ----
</body>
DIV 页脚最终挂在主表后面大约 1/4 的位置...我认为这意味着某些表/行/单元格标签未正确关闭...
我尝试放置 div围绕表单,希望这会强制浏览器自动关闭所有未关闭的标签。那没有用。
我更愿意重新编写整个内容,但是该页面没有文档记录,非常复杂,并且包含大量内容。
有什么想法吗?
I am trying to add a footer to a table-based HTML layout that has numerous nested tables. The structure looks something like this:
<head>
</head>
<body>
<form>
bloody mess of <table><tr><td> tags
</form>
--- div footer to go here ----
</body>
The DIV footer ends up hanging behind the main table about 1/4 of the way down... I assume that means some table/row/cell tags are not closed properly...
I tried putting divs around the form, hoping that would force the browser to auto-close all unclosed tags. That did not work.
I would prefer to re-write the whole thing, but the page is not documented, very complex, and has numerous includes.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为了检查您的标签是否正确关闭,您可以验证您的 HTML。
如果没有看到您的代码,很难猜测问题可能是什么,但这里有一个建议。
表格可以使用 CSS 浮动或绝对定位 (
position:absolute
)。如果是这种情况,您可能需要移除浮动或位置。鉴于您的布局当前是基于表格的,并且您没有重写整个内容,最简单的选择可能是在页脚底部添加一个额外的表格行。
In order to check whether your tags are correctly closed you may way to validate your HTML.
Without seeing your code it's difficult to guess at what the problem could be but here's a sugestion.
The table could be floated using CSS or positioned absolutely (
position:absolute
). If this is the case you may need to remove the float or positon.Given that your layout is currently table based, and given that you're not re-writing the whole thing, the easiest option may be to add an extra table row at the bottom for your footer.
让浏览器解析页面,并使用 Javascript 的 DOM 访问动态插入
:
document.createElement
node.insertAfter
这样,浏览器就会解析出“该死的混乱”。然而,这并不能保证浏览器的兼容性,因为它取决于每个不同的浏览器如何解析“混乱”。
Let the browser parse the page, and dynamically insert your
<div>
using Javascript's DOM access:document.createElement
node.insertAfter
This way, the browser will parse the "bloody mess". This does not guarantee browser compatibility, however, as it depends on how each different browser parses the "mess".