Rails adding phantom whitespace above yield
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开发者_C百科 div
) caused all browsers to add a gap at the top. Strange!
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:
<%= yield %>
I thing you looking in wrong layout, because you have
<body><%= yield %><body>
but in the screenshot you have
<body topmargin="0">
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.
精彩评论