[英]How to create a doctype with TagBuilder
!
在無法創建的doctype標簽中。 有沒有辦法放! 在使用tagbuilder的doctype標簽中。
由於Doctype不是HTML標簽 ,因此無法使用TagBuilder。
雖然,您可以返回普通的MvcHtmlString。
public static class CustomHelpers
{
public static MvcHtmlString DocType(this HtmlHelper helper)
{
var docType = @"<!DOCTYPE ...>";
return MvcHtmlString.Create(docType);
}
}
然后像這樣使用它:
@Html.DocType()
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.