From 2512178a7c86944a3678a55113a883701a6b32f2 Mon Sep 17 00:00:00 2001 From: Taylor Stauss <15224340+ttstauss@users.noreply.github.com> Date: Wed, 2 Jan 2019 14:17:07 -0700 Subject: [PATCH] CSS: Add ::selection pseudo-element document (#23750) This is a basic introduction to the ::selection pseudo-element CSS selector. This document is meant to be a starting point and should be added to/expounded on. --- .../css/selectors/pseudo/selection/index.md | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 guide/english/css/selectors/pseudo/selection/index.md diff --git a/guide/english/css/selectors/pseudo/selection/index.md b/guide/english/css/selectors/pseudo/selection/index.md new file mode 100644 index 0000000000..1b4b1c77db --- /dev/null +++ b/guide/english/css/selectors/pseudo/selection/index.md @@ -0,0 +1,28 @@ +--- +title: Selection +--- +## Selection + +The ```::selection``` CSS pseudo-element styles the portion of text a user clicks and drags their cursor over (the highlighted text). + +General Syntax: + +```css +::selection +``` + +## Example + +```css +/* "Highlighted text will be #F25757 */ +::selection { + color: #F25757; +} +``` + +The ```::selection``` CSS pseudo-element is useful for styling user selections to match your website/app theme. + +#### More Information: +* [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/CSS/::after) +* [W3 Schools](https://developer.mozilla.org/en-US/docs/Web/CSS/::selection) +* [CSS Tricks - ::selection](https://css-tricks.com/almanac/selectors/s/selection/)