是否可以在html文本框或标签中使用2个或更多类? [英] Is it possible to use 2 or more classes in html text box or label?

查看:91
本文介绍了是否可以在html文本框或标签中使用2个或更多类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个名为

  class1 的CSS课程
{
颜色 红色;
}
class2
{
color blue;
}
class3
{
color 黄色;
}



我有一个文本框

 <  输入    type   =  text    id   =  txtname    class   =  class1 class2 class3   >  



文本框包括3节课。所以在运行文本框时会出现文本的颜色,如何预测颜色。

解决方案

是的,您可以在同一个字段中使用多个类你做到了。但是你的类文件中有一些错误。

它应该在样式标签类名中加上'。'前缀,例如

 <  风格 >  

.class1
{
颜色:红色;
}
.class2
{
color:blue;
}
.class3
{
颜色:黄色;
}
< / style >





现在,在这种情况下,最后一个课程将有效(主要是最后一个重叠的属性)


Hi,
I have a CSS classes named

class1
{
color:red;
}
class2
{
color:blue;
}
class3
{
color:yellow;
}


and I have a text box

<input type="text" id="txtname" class="class1 class2 class3" >


The text box includes 3 classes. So on running the text box which will be the color of the text and how can I predict the color.

解决方案

Yes, you can use multiple class in same field as you did. But there are some mistake in your class file.
it should have '.' prefix in style tag class name like

<style>

.class1
{
color:red;
}
.class2
{
color:blue;
}
.class3
{
color:yellow;
}
</style>



Now, in such case, last class will be effective (mainly the last overlapping property)


这篇关于是否可以在html文本框或标签中使用2个或更多类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆