How do I set inline CSS to a component via Delphi in TMS Web Core?

141 Views Asked by At

In JavaScript, you can directly change the CSS on an element by simply going into the style object and changing the styles in it such as:

MyButton.style.backgroundColor = 'blue';
MyButton.style.color = 'red';

Is there a way to do this using Delphi code?

1

There are 1 best solutions below

1
Shaun Roselt On BEST ANSWER

This post was super helpful in terms of showing how to work with CSS in TMS Web Core.

You can set inline CSS using Delphi with the following code:

MyButton.ElementHandle.style.setProperty('background-color', 'blue');
MyButton.ElementHandle.style.setProperty('color', 'red');