Inline CSS ::selection doesn't working

594 views Asked by At

I want to use inline styling [via PHP], and need the ::selection and -moz-selection properties to be changed. In this project, I need randomly changed colors after pages refresh for this property.

Apparently, the css property (that is set at first place in an external file) is more dominant than inline styling, even if I use !important for inline values.

Is there any way to get inline styling work for this special property?

JsFiddle Demo

2

There are 2 answers

0
GreyRoofPigeon On

Check this question.

You can't declare a pseudo class inline, only in a stylesheet (or using <style> in the head).

0
prashant On

Check this post .

I think you are facing the same problem as on the given link . CSS just reads from top to down, therefore anything lower in the code should be overwritten . you should have to check your code with element inspector to check what css are applied to your code.