css-移動端模擬hover效果


:hover 在移動端中,點擊后一直處於hover狀態,不會切換。
為此解決:通過:active模擬

<!--
 * @Author: lingxie
 * @Date: 2020-04-23 13:35:57
 * @Descripttion: 
--> 
<template>
  <div class="about">
    <h1>This is an about page</h1>
    <div class="btn-hole">按鈕</div>
  </div>
</template>
<style lang="less">
.btn-click-active {
  display: block;
  content: "";
  position: absolute;
  top: 0px;
  left: 0px;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 10%);
}
.btn-hole {
  width: 200px;
  height: 40px;
  line-height: 40px;
  text-align: center;
  background: orange;
  position: relative;
  border-radius: 10px;
  &:active::before {
    .btn-click-active;
  }
}
</style>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM