How to Change Text Selection Color with css and tailwind css

0 min read

 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.

You may like these posts

  • This tutorial follows the latest HTML5 standard.Applications of HTMLAs mentioned before, HTML is one of the most widely used language over the web. I'm going to list few of them he…
  •  1 - Install package from GitHub In this recommended package you can find icons and font used for displaying those icons with all formats recommended by browsers …
  •  Use the ::selection selector to override the default text selection color: ::-moz-selection { /* Code for Firefox */ color: rgb(255, 255, 255); …

Post a Comment