# Using two css classes for single textfield

**URL:** https://forum.kirupa.com/t/using-two-css-classes-for-single-textfield/182753
**Category:** Uncategorized
**Created:** [March 21, 2006, 6:57am UTC](https://forum.kirupa.com/t/using-two-css-classes-for-single-textfield/182753 "2006-03-21T06:57:10Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![kernel\_flash](https://avatars.discourse-cdn.com/v4/letter/k/a87d85/32.png) [@kernel\_flash](https://forum.kirupa.com/u/kernel_flash)
#### Post date: [March 21, 2006, 6:57am UTC](https://forum.kirupa.com/t/using-two-css-classes-for-single-textfield/182753/1 "2006-03-21T06:57:10Z")

</div>

Hi,  
This is something related to applying the CSS bases stylesheet to the textfield.

Let’s say i have a css:

[AS]  
.headerSize  
{  
font-size:20pt;  
}  
.msgSize  
{  
font-size:10pt;  
}  
.first  
{  
font-family:Trebuchet MS;  
}  
[/AS]

If I were to use this in html and apply the stylesheet of header text  
it would be something like this  
[AS]  
\<p class=“first headerSize”\>This is header Text\</p\>  
[/AS]

If I do the same thing in action script it fails to apply the stylesheet.  
[AS]  
myStyle\_obj=new TextField.StyleSheet();  
myStyle\_obj.onLoad=function(succ)  
{  
if(succ)  
{  
\_root.header\_txt.styleSheet=this;  
\_root.header\_txt.html=true;  
\_root.header\_txt.htmlText="\<p class=‘first headerSize’\>Header Text\</p\>"  
}  
}  
myStyle\_obj.load(“mycss.css”);  
[/AS]

Is there any other way to achieve this thing?

---

<div class="post-metadata">

### Author: ![kernel\_flash](https://avatars.discourse-cdn.com/v4/letter/k/a87d85/32.png) [@kernel\_flash](https://forum.kirupa.com/u/kernel_flash)
#### Post date: [March 22, 2006, 5:05am UTC](https://forum.kirupa.com/t/using-two-css-classes-for-single-textfield/182753/2 "2006-03-22T05:05:20Z")

</div>

If any one has worked with css in Flash and encountered the same problem??

---

<div class="post-metadata">

### Author: ![kernel\_flash](https://avatars.discourse-cdn.com/v4/letter/k/a87d85/32.png) [@kernel\_flash](https://forum.kirupa.com/u/kernel_flash)
#### Post date: [March 23, 2006, 4:19am UTC](https://forum.kirupa.com/t/using-two-css-classes-for-single-textfield/182753/3 "2006-03-23T04:19:34Z")

</div>

oh my God!!!

i think nobody has ever done this :x

---

<div class="post-metadata">

### Author: ![daleth](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/daleth/32/1096_2.png) [@daleth](https://forum.kirupa.com/u/daleth)
#### Post date: [March 23, 2006, 10:03pm UTC](https://forum.kirupa.com/t/using-two-css-classes-for-single-textfield/182753/4 "2006-03-23T22:03:11Z")

</div>

Wait, so if you only use class=‘first’ or =‘header’ it works? You’re saying it only doesn’t work if you use both? If that’s the case, did you try just doing something like this:  
\<p class=‘first’\>\<span class=‘header’\>header text\</span\</p\>  
?

---

<div class="post-metadata">

### Author: ![kernel\_flash](https://avatars.discourse-cdn.com/v4/letter/k/a87d85/32.png) [@kernel\_flash](https://forum.kirupa.com/u/kernel_flash)
#### Post date: [March 24, 2006, 5:04am UTC](https://forum.kirupa.com/t/using-two-css-classes-for-single-textfield/182753/5 "2006-03-24T05:04:06Z")

</div>

Whoa !!!

Well it works good and great.  
But then it still requires two tags for using two tags.  
If I had 4 classes then there will b 4 html tags?? Naaaaaaahhhh…

I think i can inherit the classes in css itself and then see.

Any way thanks for the initial help.
