ASP.Net - 是否可以在后面的代码中访问非内联CSS?

时间:2016-09-01 19:54:54

标签: html css asp.net

在下面的代码中,是否可以在后面的代码中获取宽度和高度值。

<asp:Content ID="mainContent" ContentPlaceHolderID="mainContentPlaceHolder" runat="server">

    <style type="text/css">
        /* The width and height are used in the code behind */
        .myDivClass {
            width: 200px;
            height: 140px;
        }
    </style>

    <div id="myDiv" class="myDivClass" runat="server"></div>
</asp:Content>

我在后面的代码中尝试了以下代码,但它只适用于样式是内联的,我认为。使用上面的示例,样式不会显示。

previewImageDiv.Style.Item("width")

我不想要回答我 应该做的与此无关的事情。我可能会对代码背后的值进行硬编码,但我想知道是否可以按照我尝试的方式进行操作。

0 个答案:

没有答案
相关问题