如何将变量传递给css的background-image属性?

时间:2017-06-27 04:57:18

标签: css asp.net-mvc

@if (!(Model.IsPublished == false && Model.IsArchieved == false))
    {
        var watermarkImage = "../../Resources/Watermark/" + Model.Watermark + ".png";

        <style type="text/css">
            .watermark {
                background-image: url("../../Resources/Watermark/Draft5.png");
                background-repeat: repeat-y;
                top: 0;
                left: 0;
                z-index: 100000;
            }
        </style>
    }

我想传递watermarkImage background-image: url(@watermarkImage); 但这不起作用。 如何将此变量值传递给css background-image属性?

0 个答案:

没有答案