Rails 在产量之上添加幻象空白
这简直要了我的命。
应用程序布局:
<html>
<head>
...
</head>
<body topmargin="0"><%= yield %></body>
</html>
主页:
<div id="content">...</div>
然而,在所有浏览器中呈现的页面中,有一行预先格式化的空白将内容推离窗口顶部。
这是从哪里来的?
已解决
无效的 HTML 标记(li
直接位于 div
内)导致所有浏览器在顶部添加间隙。奇怪的!
This is killing me.
Application layout:
<html>
<head>
...
</head>
<body topmargin="0"><%= yield %></body>
</html>
Home:
<div id="content">...</div>
Yet in the rendered page, across all browsers, there's a line of preformatted whitespace that pushes the content off the top of the window.
Where is this coming from?
Resolved
Invalid HTML markup (li
directly within a div
) caused all browsers to add a gap at the top. Strange!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您必须在某处有一个开放的 html 标签,只需通过验证器运行您的 html 并查看它是否捕获任何内容。
http://validator.w3.org/#validate_by_input
You must have an open html tag somewhere, just run your html through a validator and see if it catches any.
http://validator.w3.org/#validate_by_input
更正您的标签:
Correct your tag:
我认为您的布局错误,因为您有
,但在屏幕截图中您有
I thing you looking in wrong layout, because you have
but in the screenshot you have
我遇到了这个问题,它困扰了我几个小时。我最终注意到导致问题的页面的文件类型为“UTF-8 Unicode(带 BOM)”,我刚刚转换了文件以删除它,并且它工作得很好。
I had this problem and it stumped me for a few hours. I eventually noticed that the pages causing issues had a file type of "UTF-8 Unicode (with BOM)" I just converted the file to remove this and it worked perfectly.