How to Change Text Selection Color with css and tailwind css

 Use the ::selection selector to override the default text selection color:


::-moz-selection {
    /* Code for Firefox */
    color: rgb(255, 255, 255);
    background: #4f46e5;
}

::selection {
    color: rgb(255, 255, 255);
    background: #4f46e5;
}
  

Tailwind CSS

<p class="selection:bg-red-500 selection:text-white">Custom form: Hi my name is Saad</p>
  

Welcome! My name is Saad, I'm web developer, graphic designer and UI/UX designer. I love creating fun things.

Post a Comment

© Wird Dev. All rights reserved. Developed by Jago Desain