CSS :focus not working

后端 未结 4 577
情话喂你
情话喂你 2020-12-10 06:12

I tried using :focus CSS pseudo-class in my project. I want to change the color of the element where I click on it. Now when I click my element cha

4条回答
  •  半阙折子戏
    2020-12-10 06:17

    What you are looking for is :visited, but this doesn't work on a div. You should use the a-tag for it (including href="#").

    .row:active, .row:visited { background: orange; }
    

    Check the fiddle below:

    http://jsfiddle.net/uuyNH/32/

    Edit: Vincent G's answer seems to do more what you want though, since you can remove the background color by clicking away.

提交回复
热议问题