从 MVC 的模型中以编程方式设置 css 值
Set css values programmatically from MVC's model
在我的 cshtml 文件中,我有以下模型指令
@model Model.Common.CameraPopupModel
如何将 Model.CustomHeight 设置为 css
中的最大高度 属性
<style>
.customBootboxWidth {
width: 1300px;
}
.restrictBodyHeight {
max-height: 420px; /*set Model.Height here instead of hardcoding */
overflow-y: auto;
}
</style>
实现此目标的最佳做法是什么?
像这样,假设 style
在视图中:
<style>
.customBootboxWidth {
width: 1300px;
}
.restrictBodyHeight {
max-height: @(Model.CustomHeight)px;
overflow-y: auto;
}
</style>
在我的 cshtml 文件中,我有以下模型指令
@model Model.Common.CameraPopupModel
如何将 Model.CustomHeight 设置为 css
中的最大高度 属性<style>
.customBootboxWidth {
width: 1300px;
}
.restrictBodyHeight {
max-height: 420px; /*set Model.Height here instead of hardcoding */
overflow-y: auto;
}
</style>
实现此目标的最佳做法是什么?
像这样,假设 style
在视图中:
<style>
.customBootboxWidth {
width: 1300px;
}
.restrictBodyHeight {
max-height: @(Model.CustomHeight)px;
overflow-y: auto;
}
</style>