@f1ip

Убрать hover при тапе с мобайла. Как?

<!DOCTYPE html>
<html lang="en" >
<head>
  <meta charset="UTF-8">
  <title>CodePen - test3</title>
  <link href="https://fonts.googleapis.com/css2?family=Montserrat&display=swap" rel="stylesheet">
<style type="text/css">
.css-grid {
  display: grid;
  grid-gap: 0.1em;
  justify-content: center;
  grid-template-columns: repeat(auto-fill, 250px);
  grid-auto-rows: minmax(190px, auto);
  overflow: hidden;
}

.flip-card {
  background-color: transparent;
  perspective: 1000px;
}
.flip-card .flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.8s cubic-bezier(0.46, 0.03, 0.52, 0.96);
  transform-style: preserve-3d;
}
.flip-card .flip-card-inner .icon {
  z-index: 1;
  color: #FAFAFA;
  position: absolute;
}
.flip-card:hover .flip-card-inner {
  transform: rotateY(180deg);
pointer-events: none;
  
}
.flip-card .front, .flip-card .back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
}
.flip-card .front {
  background-color: #FAFAFA;
  color: black;
  z-index: 2;
}
.flip-card .front img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.flip-card .front .icon {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 5em;
}
.flip-card .back {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: white;
  color: #fafafa;
  transform: rotateY(180deg);
  z-index: 2;
}
.flip-card .back h1 {
  font-family: "Montserrat", sans-serif;
  font-size: 9px;
  margin: 1px 0;
}
.flip-card .back p {
  font-family: "Montserrat", sans-serif;
  font-size: 12px;
  line-height: 14px;
  margin-right: 20px;
  margin-left: 20px;
}
.button {
   
    border: none;
    color: white;
    padding: 1px 1px;
    text-align: center;
    font-family: "Montserrat", sans-serif;
    text-decoration: none;
    display: inline-block;
    font-size: 14px;
    margin: 4px 2px;
    cursor: pointer;
}


</style>

</head>
<body>
<!-- partial:index.partial.html -->
<div class="css-grid">
<!-- 1 -->
  <div class="flip-card">
    <div class="flip-card-inner">
      <div class="front"><img src="https://manders.ru/upload/medialibrary/f85/ow73fx485wu49d6m3cr6sk1lv1w9esur.jpg"/>
      </div>
      <div class="back">
        <p>Мы все живем на белом свете, и белый цвет является для меня основным цветом для зданий, интерьеров и предметов дизайна. Белый содержит в себе всю цветовую гамму. Мы видим белый цвет, когда предметы и здания отражают все цвета радуги</p>
<a href="#" class="button">Получить палитру</a>
      </div>
    </div>
  </div>


При убирании мышки с элемента, на дестктопе все нормально,но на мобильной версии hover убирается при нажатии на соседний элемент или в пустое место на экране. Как сделать так, что бы можно было убирать hover при клике на этот же элемент.

И заолдно вопрос спрошу, при переносе этого кода на codepen, на ховере нет текста, просто белый фон, в чем может быть проблема?
  • Вопрос задан
  • 114 просмотров
Пригласить эксперта
Ответы на вопрос 1
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы