div background color, to change onhover

后端 未结 10 1314
轮回少年
轮回少年 2020-11-27 04:54

I\'m trying to make a div\'s background color change on mouse over.

the div {background:white;}
the div a:hover{background:grey

10条回答
  •  旧时难觅i
    2020-11-27 05:28

    you could just contain the div in anchor tag like this:

    a{
      text-decoration:none;
      color:#ffffff;
    }
    a div{
      width:100px;
      height:100px;
      background:#ff4500;
    }
    a div:hover{
      background:#0078d7;
    }
    
    
    
    Hover me

提交回复
热议问题