Stoll_Meik
(Stoll Meik)
January 26, 2024, 1:06pm
1
Using latest WebCore in Delphi, I can't change the font color of a TWebLinkLabel.
I tried:
setting property font.color of the component at design time
using WebLinkLabel1.ElementHandle.style.SetProperty('color', 'green');
defining a CSS class in the project html file and assigning this to the label
(setting background color by
WebLinkLabel1.ElementHandle.style.SetProperty('background-color', 'green');
works, but that's not my intention)
Tunde
(Tünde Keller)
January 26, 2024, 2:03pm
2
Hi,
I assume you want to change the color of the link itself? CSS should work for that, it's not clear what you tried exactly.
<style>
.custom-link-color {color: #0000ff;} /*Color of any non-link text*/
.custom-link-color a {color: #ff0000;} /*Color of unvisited links*/
.custom-link-color a:visited {color: #00ff00;} /*Color of visited links*/
.custom-link-color a:hover {color: #ffcc00;} /*Color of hovered links*/
</style>
Then assign custom-link-color
to the TWebLinkLabel.ElementClassName
property.
Stoll_Meik
(Stoll Meik)
January 26, 2024, 2:14pm
3
Thanks, great, that works!
(I didn't include the "a" tag in the CSS code because I didn't realize that this is needed... Dealing with the web for me means learning (at least) one new thing per day... )