csshovertouch

Equivalent to hover for mobile apps


What would be and equivalent for CSS hover on devices that have a touch screen, like tablets and smartphones?

I am trying to show arrows on my carousel, for desktop, I know I can use hover, but what to use when there is no cursor to hover with?


Solution

  • Use :active selector in combination with :hover.

    :active selector should be called after the :hover selector.

    Example

     .button:hover, .button:active{
       background-color: red;
     }