Equivalent to hover for mobile aps

前端 未结 2 1584
小蘑菇
小蘑菇 2021-01-21 01:58

What would be and equivalent for CSS hover, just to be used on devices that have a touch screen, like tablet and smartphones? I am trying to show arrows on my carousel, for des

相关标签:
2条回答
  • 2021-01-21 02:35

    I believe that by default, touch devices do not have Hover effect, or at least they "treat" it differently - like a click event.

    Example: if you have a dropdown menu on Hover on desktop machines, it will automatically be a dropdown menu on click on mobile touch devices.

    As for current inquiry, I can propose a workaround, to show the arrows on devices with max-width smaller than 1200px.

    0 讨论(0)
  • 2021-01-21 02:46

    Use :active selector in combination with :hover.

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

    Example

     .button:hover, .button:active{
       background-color: red;
     }
    
    0 讨论(0)
提交回复
热议问题