Selection in CSS | CSS ::selection

By | June 3, 2020

Selection in CSS | How To Change Text Selection Color

Selection in CSS ::selection is a selector of CSS, that highlighted the text, which is selected by the user.

For example, a part of a web page that is selected by the user using any device like a mouse or any pointing device.

See an image (selection CSS), also I provide the complete demo of Selection in CSS,

Selction in CSS | CSS ::selection

When you use ::selection Selection in CSS that can change the background and foreground of the text of selected text.

CSS Syntax | ::selection

On the below example, we change the background text color using ::selection CSS property,

The above ::selection CSS code supported by all the browser but for Mozilla firefox, we change the code,

How to disable text selection highlighting

Here is a code for disable text selection highlighting,

CSS ::selection Live Demo

See the Pen CSS ::selection PHPCODER.TECH by Bikash Panda (@phpcodertech) on CodePen.

Happy Coding..!

Share and Enjoy !

0Shares
0 0

Subscribe For Latest Updates

Sign up to best of PHP Code Solutions, informed analysis and opinions on what matters to you.
Invalid email address
We promise not to spam you. You can unsubscribe at any time.

11 thoughts on “Selection in CSS | CSS ::selection

  1. Pingback: CSS Background Image Text Effect - PHPCODER.TECH

  2. Pingback: Install Composer on Linux and Windows in 3 Steps - PHPCODER.TECH

  3. Pingback: Check First Value Greater in Multiple Inputs with Same Class Name using jQuery - PHPCODER.TECH

  4. Pingback: How to Convert JSON to Array PHP - PHPCODER.TECH

  5. Pingback: JavaScript Append HTML to Body - PHPCODER.TECH

  6. Pingback: 4 Simple Steps To Braintree Account Setup with API - PHPCODER.TECH

  7. Pingback: Full Forms Related to Computer Programming - PHPCODER.TECH

  8. Pingback: Check if JavaScript variable is NULL or Undefined - PHPCODER.TECH

  9. Pingback: Display Current Date & Time in HTML using Javascript-PHPCODER.TECH

  10. Pingback: Login with Google Account using PHP Step by Step - PHPCODER.TECH

  11. Pingback: CSS background-image Properties - PHPCODER.TECH

Leave a Reply

Your email address will not be published. Required fields are marked *