div background color, to change onhover

后端 未结 10 1312
轮回少年
轮回少年 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条回答
  •  天涯浪人
    2020-11-27 05:15

    To make the whole div act as a link, set the anchor tag as:

    display: block
    

    And set your height of the anchor tag to 100%. Then set a fixed height to your div tag. Then style your anchor tag like usual.

    For example:

    
    
        DIV Link
    
        
    
    
    
    
        
    
        
    
     
    

    Good luck!

提交回复
热议问题