-1

How can I use a:hover in inline CSS inside the HTML style attribute like this but doesn't work

 <div
      style={{
        "&:hover": {
         background: "#efefef"
         },
        }} >
 </div>
Damini Suthar
  • 1,470
  • 2
  • 14
  • 43
Adriano
  • 11
  • 2

2 Answers2

0

You can do this way.

a:hover {
  background-color: yellow;
}

See the full answer here. https://codepen.io/charp95/pen/LYQxZrm

Demodev
  • 94
  • 10
0
<a href="mypage.html"
   onMouseOver="this.style.color='#FFF'"
   onMouseOut="this.style.color='#000'" >Whatever you have to display</a>

You can try this, using onMouseOver and onMouseOut, this gives the same effect but it's not efficient for many elements.

Python
  • 471
  • 1
  • 5
  • 14