CSS in Style Tag

Jun 21, 2011 at 4:21 AM

Hi All,

I've found a problem with CSS code inside Style Tag. The CSS code will all be removed when it is sanitized. I use GetSafeHtmlFragment function.

Are there anyways to keep the CSS code inside the Style Tag ?

Thanks

Jun 21, 2011 at 5:22 AM

I found the problem. It is because I didn't put the Style Class.

 

So, if the input is

 

<style type="text/css">

p {color:red}

</style>

 

it will be sanitized into

 

<style type="text/css">

<!--

-->

</style>


 

But, if I use class :

 

<style type="text/css">

p.red {color:red}

</style>

 

 

It will be sanitized into :

 

<style type="text/css">

<!--

p.x_red {color:red}

-->

</style>

 

 

My question is, why is it required to have a class ?