::selection pseudo-element outline property

放肆的年华 提交于 2019-12-11 13:01:45

问题


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 ::selection pseudo-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 ::selection pseudo-elements: color, background, cursor (optional), outline (optional). The computed value of the 'background-image' property on ::selection may 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!