Skip to main content
1-Visitor
September 3, 2019
Question

I am facing problem in providing color to text in label widget using css code .

  • September 3, 2019
  • 3 replies
  • 2699 views

I am facing problem in providing color to text in label widget using CSS code .i WILL PROVIDE THE CODE BELOW :

 

.simple-label {
width: auto;
height: auto;
display: flex;
color: red;
font-weight: 400;
line-height: 14px;
}

3 replies

18-Opal
September 3, 2019

Hello,

 

Why don't you use Style property of the widget instead? If you reuse your Style objects consistently, it will be more flexible and easier to maintain in the long-run.

 

/ Constantine

1-Visitor
September 3, 2019

I want to try it using CSS code.Please give me some suggestions

17-Peridot
September 3, 2019

Hi,

 

This will work (change CSS class in label widget):

 

.label-text {
width: auto;
height: auto;
display: flex;
color: red;
font-weight: 400;
line-height: 14px;
}

 

Best regards,

Raluca Edu

1-Visitor
September 3, 2019

No .it did not work if i change the css class too

17-Peridot
September 3, 2019

In 8.4.4 worked, what version are you using?

18-Opal
September 3, 2019

@sanjanabalaji In your original example, add ".label-text" to the CSS selector like that:

.simple-label .label-text {
 width: auto;
 height: auto;
 display: flex;
 color: red;
 font-weight: 400;
 line-height: 14px;
}

The custom CSS class is applied to the DIV, which encloses the SPAN with "label-text" (not to the SPAN itself), so you need to specify an explicit CSS selector to override "label-text" parameters (dark-gray color, bold, etc.)

 

/ Constantine