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>
