Give help. Get help.
is impossible to change a property value in style.css by search and replace.
for ex . I want to change width of a psudo element dynamicly.
and this is the best practice.or website maybe slow.
Pseudo-elements can’t be selected by JS as the aren’t in the DOM.
Frankly, I’m not entirely sure what it is you are trying to do but changing the CSS stylesheet would require a regex parse I think.
These things are usually handled by changing classes and affecting the pseudo-elements that way.
Pseudos can be selected with JS (which I didn’t realise until shortly) but are only readable. Changing their properties isn’t possible. What you would be looking for is this:
Like Paulie mentioned, the script will need to use a regex and go through the entire stylesheet to find a match. Both the external accessing of the file and especially this search will certainly be a slow and “intensive” approach.
An example, I found it quite complicated:
You must be logged in to reply to this topic.