[英]Set css values programmatically from MVC's model
在我的cshtml文件中,我具有以下模型指令
@model Model.Common.CameraPopupModel
如何在CSS中將Model.CustomHeight設置為max-height屬性
<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>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.