Razor 视图 - 模板顶部的额外线条 [英] Razor View - Extra line at top of template

查看:51
本文介绍了Razor 视图 - 模板顶部的额外线条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

@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>

呈现为:

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

我的理解是,这个额外的行会导致旧版本的 IE 出现问题,迫使浏览器进入 quirks 模式.

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

这可以通过将 Layout deceleration 和 doctype 放在同一行来解决,但这有点难看.(虽然不像过渡文档类型那样丑陋,但这从来都不是一件美事!)

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!)

推荐答案

你总是可以颠倒这些指令出现的顺序:

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>

这篇关于Razor 视图 - 模板顶部的额外线条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆