在Html头中添加文本信息

时间:2017-01-30 22:44:39

标签: asp.net-mvc-4 razor

这可能是非常简单的事情,但我很难做到这一点。我必须在页面的标题信息中添加一些附加信息。问题是信息总是在身体而不是标题中结束。

以下是示例代码

@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <text id="test">
        //Wish to add some additional information here
        tester
    </text>
    <title>Test Heading</title>
</head>
<body>

</body>
</html>

2 个答案:

答案 0 :(得分:1)

@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Test Heading</title>
  <meta name="description" content="Latest sports news and live scores from Yahoo! Eurosport UK. Complete sport coverage with Football results, Cricket scores, F1, Golf, Rugby, Tennis and more.">
  <meta name="keywords" content="eurosport,sports,sport,sports news,live scores,football,cricket,f1,golf,rugby,tennis,uk,yahoo">


</head>
<body>

</body>
</html>

答案 1 :(得分:0)

客户强迫浏览器表现得像IE8;因此,在标题中添加xml标记。为IE8兼容性添加一行就是他们的诀窍。

<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=8;" />
    <meta name="viewport" content="width=device-width" />
 <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
    <text id="students">
       <name>Name</name>
       <sCode>122</sCode>
    </text>
    <title>Test Heading</title>
</head>
<body>

</body>
</html>