Easily change the selection color with CSS

Kevin Powell on YouTubeWatch on YouTube

SaveMark complete

Sign in to save videos and track what you’ve finished.

BeginnerUI3 min

About this video

A short CSS tutorial showing how to change the colour of selected text on a web page using the ::selection pseudo-element. It suits people building websites who want a small visual detail that improves the user experience.

What you’ll learn

  • Style selected text colour with the ::selection pseudo-element
  • Set background and text colours for highlighted content in CSS