Getting pseudo-element style values

Related to this question Changing CSS pseudo-element styles via JavaScript , is there a way to use javascript so that I can access the pseudo-element style attributes?

+2
source share
1 answer

It depends on the browser. I do not believe that IE supports this in any way, but for FireFox and Webkit browsers you can use the following:

window.getComputedStyle(element, pseudo-selector);

For example:

window.getComputedStyle(document.body, ':before');

See: getComputedStyle

+5
source

Source: https://habr.com/ru/post/1524685/


All Articles