HDTutorial
EN

Playback starts YouTube’s embedded player (privacy-enhanced mode).

How to change the text highlight color and styles | HTML, CSS Tutorial

16,047 views November 1, 2018 2:22

Watch on YouTube
Channeldcode

Description from the creator

Through the use of some basic CSS rules you are able to quite easily change the text color and background color of the area selected (or highlighted) by the user.

This is done through the ::selection pseudo-element and is rather straightforward - however a slightly different syntax is required for support in Firefox.

In this video I take you through a simple example of how you can use this in your next website or web project - but be careful because it is a concern to accessibility: you will need to make sure the new styles have enough contrast to be visible by visually impaired users.

For your reference, check this out:
developer.mozilla.org/en-US/docs/Web/CSS/::sele…

Follow me on Twitter @dcode!

If this video helped you out and you'd like to see more, make sure to leave a like and subscribe to dcode!

About this tutorial

dcode published this 2:22 video tutorial on November 1, 2018. It has been watched 16,047 times on YouTube.

Channel
dcode
Category
Education
Duration
2:22
Published
November 1, 2018
Views
16,047
Likes
130

Share

This tutorial in other languages