Skip to main content
10-Marble
March 30, 2023
Question

Need to use style ctx in custom css for changing font-size of a button

  • March 30, 2023
  • 2 replies
  • 2026 views

HI Team,

I have a button on which I gave custom class and using root of it, I am able to change its background color, but I am unable to change font-size of that button.

I tried to change it via many things, but its only changing when I am expanding #shadow-root (open) and changing value under <style ctx="PTC-BUTTON.danger"> [part~=label] {

font-size: 18px}

I am not able to use it in custom css as I am not aware how to use ctx in custom css.

Can anyone please guide me on it?

 

My current css is:

.classqa, #root_ptcsbutton-150{

background: #d91717

}

 

2 replies

5-Regular Member
March 30, 2023

Hello @VK_10159720 

 

Pls check the following article, In this you may find the solution:

 

https://www.ptc.com/en/support/article/cs322901

 

Thanks

Bhawna

17-Peridot
March 31, 2023

Hello,

 

There is no need to do this using CSS, you can change the background color and font size of the text using the built in functionality.

This is also the recommended way by PTC.

 

Background color:

jensc_0-1680242809428.png

Font size:

jensc_1-1680242834405.png

 

Perhaps if you use a lower version of Thingworx this might not be possible. But if I remember correctly it should at least be possible from 9.1.

 

Regards,

Jens

10-Marble
March 31, 2023

HI @jensc,

 

It is not picking mentioned font-size in style properties as per your suggestion. It is displaying some different values. I even tried to remove style theme as well, but didn't help. but if i refresh the mashup in runtime, then it takes correct value as specified in style properties.

That is why I had to change via css. 

5-Regular Member
March 31, 2023

Hello @VK_10159720 , 

 

Have you tried the shared article?

If that is not providing the expected solution. In my opinion, pls open a case with Tech support team.

 

Thanks

Bhawna