我上过这门课
.progress {
width:200px;
height:50px;
border:1px solid black;
position:relative;
}
.progress:after {
position:absolute;
background:black;
top:0; bottom:0;
left:0;
width:10%;
-webkit-animation: filler 2s ease-in-out;
-moz-animation: filler 2s ease-in-out;
animation: filler 2s ease-in-out;
}并使用此div
<div id="percentDIV" class="progress" runat="server">some text</div>我想在c#中动态更改progress:after类的宽度属性。有可能吗?
就像这样?
percentDIV.Attributes["class:progress:after"] = "width:25%";发布于 2014-11-07 02:10:22
将下一个div声明为runat="server"并更改其样式
percentDiv.Attributes["style"] = "width:20%";样式优先于类。
另一种方法是从CSS中删除类声明,并使用runat="server"控件在页面标题部分动态创建它,用动态创建的css类替换它的内容。
发布于 2014-11-07 01:50:51
percentDIV.Attributes["style"] = "width:20%";https://stackoverflow.com/questions/26785986
复制相似问题