I've always wondered whether whitespace before a DOCTYPE matters, but I can't seem to find any definitive information on the web. People say not to do it, but I can't see what effect it's likely to have, or even if the spec says it must be like that. I can't figure out if it triggers compatibility mode in IE or anything annoying like that.
The reason is, in my (crappy asp.net) code, I would much prefer to write:
<%@ Page language="c#" Codepage="65001" AutoEventWireup="true" %>
<%@ OutputCache Location="None" VaryByParam="none" %>
<!doctype html>
than:
<%@ Page language="c#" Codepage="65001" AutoEventWireup="true" %><%@ OutputCache Location="None" VaryByParam="none" %><!doctype html>
Because the first is neater. But the result of the top one is a few blank lines in your rendered html.
Not a huge issue. I've just always wondered if it matters :)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…