问题
In this reference
At the bottom of the description,
They state that the ::selection selector can use the outline property, but I haven't been able to get this to work.
How do I affect outline with this selector properly?
回答1:
An important note from the Mozilla Developer Network:
The
::selectionpseudo-element currently isn't in any CSS module on the standard track. It should not be used in production environments.
Which browser supports which properties on this pseudo-element is largely irrelevant today. You'll likely not get a consistent cross-browser experience, so you're probably better of avoiding the fringe details and stick to what each browser supports.
When ::selection was in the Selectors Specification (December 2005), we would read:
These are the CSS properties that apply to
::selectionpseudo-elements:color,background,cursor(optional),outline(optional). The computed value of the 'background-image' property on::selectionmay be ignored.
The color and background-color properties appear to be the best supported since they were the only non-optional values. Some browsers even support text-shadow, though it was not listed in the Specification.
I would avoid trying to achieve support for anything else cross-browser. Ultimately, keep in mind that non-standard features like this could up and vanish in the future. So don't get too attached to it.
Implementation and Support Details
- Mozilla Developer Network
- Microsoft Developer Network
来源:https://stackoverflow.com/questions/22641879/selection-pseudo-element-outline-property