如何添加两个CSS类在后面的code控制? [英] How to add two CSS Class to control in the code behind?
本文介绍了如何添加两个CSS类在后面的code控制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我设置2 CSS类的code背后ASP.NET
I am setting 2 css class in the code behind in ASP.NET
我既可以做的:
txtBox.Attributes.Add("class", "myClass1");
txtBox.Attributes.Add("class", "myClass2");
它总是将一个类..我如何添加THW两个班?
it's always apply one Class .. How can i add thw two classes ?
推荐答案
Add方法实际上是一个看跌的,因为它取代behing关键值类
。在HTML / CSS,你可以用空格分隔有几类。
The Add method is actually a Put, since it replaces the value behing the key "class"
. In HTML/css you can have several classes by separating with a space.
txtBox.Attributes.Add("class", "myClass1 myClass2");
这篇关于如何添加两个CSS类在后面的code控制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文