# TextField with CSS- setStyle and then reload

**URL:** <https://forum.kirupa.com/t/textfield-with-css-setstyle-and-then-reload/251102>\
**Category:** flash\
**Created:** [February 5, 2008, 12:42pm UTC](https://forum.kirupa.com/t/textfield-with-css-setstyle-and-then-reload/251102 "2008-02-05T12:42:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lilalfyalien](https://avatars.discourse-cdn.com/v4/letter/l/ac91a4/32.png) [@lilalfyalien](https://forum.kirupa.com/u/lilalfyalien)\
**Post date:** [February 5, 2008, 12:42pm UTC](https://forum.kirupa.com/t/textfield-with-css-setstyle-and-then-reload/251102/1 "2008-02-05T12:42:09Z")

</div>

[LEFT]Hi,

I have a dynamic textbox, “txtMain”, it loads in html text and then I apply a CSS to it. All works great. Now what I want to be able to do is simply change the font-size at a click on a button i.e. make the text bigger. Here’s my code so far:

```auto
var format = new TextField.StyleSheet();
var path = "main.css";
format.load(path);
txtMain.styleSheet = format;
txtMain.text = htmlText;

```

then on the button handler:

```auto
on(release) {
format.setStyle("imagecaption", {fontsize:'30px'});
txtMain.styleSheet = format;
}

```

My stylesheet:

```auto
 p 
 {
    font-family: Arial, Helvetica, Verdana;
    
 }
  .imagecaption {
    font-size: 24px;
    font-weight: bold;
  }
  .normal {
    font-size: 40px;
  }

```

My HTML:

```auto
<p class="normal">This is normal</p><p class="imagecaption">This is image caption</p>

```

It doesn’t seem to work, can anyone help?

Thanks,

Lilalfyalien  
[/LEFT]
