Skip to Content
0

how to apply two css classses to FORMATEEDTEXTVIEW component ?

Sep 18, 2017 at 04:38 PM

67

avatar image
Former Member

Can i apply two CSS classes to one FORMTTEDTEXTVIEW component ?

I need to achieve two different colors for a single single sentence and show it on a FORMATTEDTEXTVIEW .

I have tried the following html text and i have defined two css classes in 'colorblue' and 'colorred' in css file

<p class="colorblue"> Some text <p>

<p class="colorred"> Another text :)</p>

var html =  '<p> Some text <p> <p> Another text :)</p>';
FORMATTEDTEXTVIEW_1.setHtmlText(html); 

I dont want to use two Components as text is dynamic and length isnt constant .

" This a string text which i need in two different colors and its dynamic "

Thanks,

Pramod

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
VISHWA RATNA Nov 16, 2017 at 01:25 PM
0

This is how I managed to do it:

1. on-startup script:

2. CSS :

3. Assign css class to component:

4. Voila !!


capture1.png (6.9 kB)
capture2.png (4.4 kB)
capture3.png (34.7 kB)
capture4.png (15.8 kB)
Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Sorry for late reply. Thanks for solution.

I have done something similar

'<p> <span class ="Pagetitle"> Title   </span>  <span class ="Pagesubtitle"> subtitle</span>  </p>  ' ;
0
Mustafa Bensan Sep 18, 2017 at 10:57 PM
0

Hi Pramod,

Did you try executing the following script code to apply the CSS?:

FORMATTEDTEXTVIEW_1.setCSSClass("colorblue colorred")

Regards,

Mustafa.

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Mustafa,

I have tried that but it didnt work me. I was initially using color attribute in html tag which didn't yield any results and finally end up using Span and CSS attributes to get it work.

thanks

Pramod

0