【问题标题】:Razor View - Extra line at top of templateRazor View - 模板顶部的额外行
【发布时间】:2013-10-29 17:02:32
【问题描述】:
@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 出现问题,迫使浏览器进入怪异模式。

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

【问题讨论】:

    标签: razor


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-09-27
      • 1970-01-01
      • 1970-01-01
      • 2012-12-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多