【发布时间】:2023-03-27 18:59:01
【问题描述】:
我需要在我的 Razor 页面中覆盖一些 <style> 元素,因此我在打开代码块之后立即插入了样式:
@{
ViewBag.Title = "New Account";
Layout = "~/Views/Shared/_Layout_Form.cshtml";
}
<style type="text/css">
#main
{
height: 400px;
}
</style>
页面在浏览器中正确呈现,但 Visual Studio 绿色曲线在<style> 处显示:
<Validation (XHTML 1.0 Transitional): Element 'style' cannot be nested within element 'style'>
我已经仔细检查了母版页 - 没有突出显示的问题。
Visual Studio 在这一点上期待什么?逐页覆盖样式的正确方法是什么?通过 jQuery?
【问题讨论】: