Razor View - Extra line at top of template

2019-08-29 16:40发布

@inherits VooDooBytes.Site
@{
Layout = null;
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>

Is rendered as:

--- empty line ---
<!DOCTYPE etc...

My understanding is that this additional line can cause issues with elder versions of IE, forcing the browser into quirks mode.

This can be resolved, by putting the Layout deceleration and doctype on the same line, but that's a bit, well ugly. (although not as ugly as the transitional doctype, that was never a thing of beauty!)

标签: razor
1条回答
干净又极端
2楼-- · 2019-08-29 17:17

You could always invert the order in which those directives are appearing:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@inherits VooDooBytes.Site
@{ Layout = null; }
<html>
查看更多
登录 后发表回答