-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,386
  • 2
  • 9
  • 34
Adriano
  • 1
  • 1

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
  • 48
  • 7
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
  • 125
  • 1
  • 11