HTML5元素“传奇”出现过几次 [英] HTML5 Element 'legend' occurs too few times
问题描述
我在MVC下查看和我得到的警告信息:验证(HTML5):元素'传说'出现过几次
I have the following View in MVC and I get the warning message: Validation (HTML5): Element 'legend' occurs too few times
@model Berwin.Models.ViewModels.UserViewModel
@{
ViewBag.Title = "Press";
}
<h2>Press Area</h2>
@using (Html.BeginForm("Register", "PressController", FormMethod.Post))
{
<fieldset>
@Html.TextBoxFor(model => model.FullName)
</fieldset>
<fieldset>
@Html.TextBoxFor(model => model.Company)
</fieldset>
<fieldset>
@Html.TextBoxFor(model => model.EmailAddress)
</fieldset>
<fieldset>
@Html.CheckBoxFor(model => model.JoinMailingList)
</fieldset>
}
想知道为什么我收到这样的警告,我需要做什么来解决这个问题的。
Would like to know why I am getting this warning and what I need to do to fix this.
推荐答案
根据HTML 5规范中,&LT;传奇&GT;
标签不是必需的元素中的&LT;字段集方式&gt;
According the HTML 5 spec, the <legend>
tag is not a required element within a <fieldset>
.
再$ P $图例元素psents为内容的其余部分的标题
图例元素的父fieldset元素的,如果有的话。
The legend element represents a caption for the rest of the contents of the legend element's parent fieldset element, if any.
文件:<一href=\"http://www.w3.org/TR/html5/forms.html#the-legend-element\">http://www.w3.org/TR/html5/forms.html#the-legend-element
在你的情况,它只是一个警告由Visual Studio或插件提供。它不是必需的,有可能是一种方式来苏preSS工具下的警告 - 选项 - 文本编辑器 - HTML - 验证。在这里,你还可以切换您的验证(HTML 5,XHTML 1等)
In your case, its just a warning provided by Visual Studio or a plugin. Its not required and there may be a way to supress the warning under Tools - Options - Text Editor - HTML - Validation. Here you can also switch the target of your validation (HTML 5, XHTML 1, etc)
这篇关于HTML5元素“传奇”出现过几次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!