首页 > 移动平台 > 详细

css-移动端模拟hover效果

时间:2020-06-01 20:08:18      阅读:362      评论:0      收藏:0      [点我收藏+]

: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>

 

css-移动端模拟hover效果

原文:https://www.cnblogs.com/lingXie/p/13026984.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!