Changing background colour of tr element on mouseover

前端 未结 9 927
一向
一向 2021-02-01 13:00

I want to have my table rows highlighted on mouse over, but I have yet to find a way to do it that isn\'t using Javascript. Is this not possible in CSS?

I\'ve tried this

9条回答
  •  太阳男子
    2021-02-01 13:28

    You can give the tr an id and do it.

    tr#element{
        background-color: green;
        cursor: pointer;
        height: 30px;
    
    }
    
    tr#element:hover{
        background-color: blue;
        cursor: pointer;
    
    }
    
    

提交回复
热议问题