skip to Main Content

How can I change the text color inside a div on hover?
The text color doesn’t seem to change, but everything else does

Here’s a look at what am talking about

<div className="hover:bg-blue-100 hover:border-blue-500 hover:text-blue-600">
    <p>Change textcolor inside here....</p>
</div>

2

Answers


  1. As Gabriele mentioned, use the class attribute if this is standard HTML and not JSX.

    <link href="https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet" />
    <div class="hover:bg-blue-100 hover:border-blue-500 hover:text-blue-600">
      <p>Change textcolor inside here....</p>
    </div>
    Login or Signup to reply.
  2. in order to change the aspect of an element with hover you must to put this into the css

    .myelementclass:hover {
     color:red;
     }
    

    where red could be any other color and .myelemntclass is just the class name of your element.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search