Skip to main content
Sep 3, 2019 7:53 AM UTC
Question

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

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;
}

8 replies

Sep 3, 2019 2:03 PM UTC

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

Sep 3, 2019 2:19 PM UTC

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

Sep 3, 2019 2:16 PM UTC

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

Sep 3, 2019 2:22 PM UTC

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

Sep 3, 2019 2:23 PM UTC

In 8.4.4 worked, what version are you using?

Sep 3, 2019 2:57 PM UTC

@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