Hi I want to give the p tag selection styles, but it doesn't work, any idea why?
body.blog p::selection,
body.blog p::-moz-selection {
color: red;
}
<body >
<p >This text should be red when selected.</p>
</body>
Any help appreciated.
CodePudding user response:
When a browser encounters a selector it does not support it ignores the whole rule.
So separate the rules.
p::-moz-selection {
color: red;
}
p::selection {
color: red;
}
<p >This text should be red when selected.</p>