C# 覆盖_Layout.cshtml中的宽度
在共享布局中,我在body container div上指定了一个宽度 有没有办法在我的一个视图中覆盖这个宽度? 我想继续使用共享布局的其余部分C# 覆盖_Layout.cshtml中的宽度,c#,css,.net,model-view-controller,shared,C#,Css,.net,Model View Controller,Shared,在共享布局中,我在body container div上指定了一个宽度 有没有办法在我的一个视图中覆盖这个宽度? 我想继续使用共享布局的其余部分 谢谢。您可以使用ViewBag中传递的参数指定宽度。如果参数不存在,请使用默认值 在_Layout.cshtml中: @{ var layoutWidth = ViewBag.LayoutWidth ?? "640px" /* default value */; } <div id="body-container" style="width:
谢谢。您可以使用ViewBag中传递的参数指定宽度。如果参数不存在,请使用默认值 在_Layout.cshtml中:
@{ var layoutWidth = ViewBag.LayoutWidth ?? "640px" /* default value */; }
<div id="body-container" style="width: @layoutWidth;"> ... </div>
可以使用在ViewBag中传递的参数指定宽度。如果参数不存在,请使用默认值 在_Layout.cshtml中:
@{ var layoutWidth = ViewBag.LayoutWidth ?? "640px" /* default value */; }
<div id="body-container" style="width: @layoutWidth;"> ... </div>
有3种解决方案:
1) 在每个视图中放置车身容器
2) 内部视图车身容器{宽度:1000px!重要}
3) 使用javascript覆盖css。有3种解决方案:
1) 在每个视图中放置车身容器
2) 内部视图车身容器{宽度:1000px!重要}
3) 使用javascript覆盖css