Hongmu Notes
Home Language Notes css to create a double-sided card that rotates on hover
Language Notes CSS

css to create a double-sided card that rotates on hover

css to create a double-sided card that rotates on hover

Create a double-sided card that rotates on hover.
创建悬停时旋转的双面卡

Set the card's to None. backface-visibility
Initially, set the back of the card to and the front to . rotateY()-180deg0deg
On hover, set front to and back . rotateY()180deg0deg
Set appropriate values to create a rotation effect. perspective


<div class="card">
  <div class="card-side front">
    <div>Front Side</div>
  </div>
  <div class="card-side back">
    <div>Back Side</div>
  </div>
</div>

.card {
  perspective: 150rem;
  -webkit-perspective: 150rem;
  -moz--perspective: 150rem;
  position: relative;
  height: 40rem;
  max-width: 400px;
  margin: 2rem;
  box-shadow: none;
  background: none;
}

.card-side {
  height: 35rem;
  border-radius: 15px;
  transition: all 0.8s ease;
  backface-visibility: hidden;
  position: absolute;
  top: 0;
  left: 0;
  width: 80%;
  padding:2rem;
  color: white
}

.card-side.back {
  transform: rotateY(-180deg);
  background-color: #4158D0;
  background-image: linear-gradient(43deg, #4158D0 0%,#C850C0 46%, #FFCC70 100%);
}

.card-side.front {
  background-color: #0093E9;
  background-image: linear-gradient(160deg, #0093E9 0%, #80D0C7 100%);
}

.card:hover .card-side.front {
  transform: rotateY(180deg);
}

.card:hover .card-side.back {
  transform: rotateY(0deg);
}

 

微信赞赏

WeChat

支付宝赞赏

Alipay

✍️ Author: Hong Mu

webmaster · Thanks for reading, stay tuned for more exciting content

Author homepage View home page →

Related articles

css positioning

css positioning Language Notes CSS

Syntax: position: static | relative | absolute | fixed | center | page | sticky Default value: static Applies to: All elements except the display attribute defined as table-column-group | table-column Inheritance: No Animation: No...
👁 119
css vh and vw adaptive

css vh and vw adaptive Language Notes CSS

In the mobile terminal, REM is used to change the root HTML, and the mobile terminal adaptation is realized through a piece of JS. This article uses pure CSS viewport units to self-adapt. Although the current compatibility is not fully acceptable, it does not prevent you from recognizing the power of vw and vh. The implementation of responsive layout relies on media queries (Media Queries). Select the width size of mainstream devices as breakpoints to target...
👁 356

Recommended reading

Responsive Advertising Design Creative Agency Website Template 1123

Responsive Advertising Design Creative Agency Website Template 1123 Practical Collection Yiyou template

An eyouCMS responsive website template designed for advertising design and creative agencies. Its innovative visual design style is ideal for showcasing advertising design works, creative case studies, brand strategy initiatives, and service offerings. This template helps advertising agencies demonstrate their professional expertise online and attract brand clients. Template Display | Installation Instructions | Website Backend: /login.php | Username: admin | Password: admin | Related Articles: Summary of Common Installation Issues for YouyouCMS...
👁 46
Responsive Web Design – Advertising Design Agency Website Template 1124

Responsive Web Design – Advertising Design Agency Website Template 1124 Practical Collection Yiyou template

This EyouCMS responsive template is ideal for web design and advertising agencies. Its creative and professional design style is perfect for showcasing website designs, advertising creatives, brand visuals, and case studies. It helps design firms demonstrate their expertise online and attract corporate clients. Template Display | Installation Instructions | Website Backend: /login.php | Username: admin | Password: admin | Related Articles: Summary of Common Installation Issues for EyouCMS | EyouCMS...
👁 45
Creative Design – Advertising & Printing Website Templates (1125)

Creative Design – Advertising & Printing Website Templates (1125) Practical Collection Yiyou template

An eyouCMS website template designed for the creative design, advertising, and printing industries. Its innovative visual design style is ideal for showcasing design works, advertising concepts, printing processes, and brand case studies. This template helps design and printing companies demonstrate their professional expertise online and attract corporate clients. Template Display | Installation Instructions | Website Backend: /login.php | Username: admin | Password: admin | Related Articles: Summary of Common Installation Issues for YouyouCMS...
👁 43
Resource website typecho001 template

Resource website typecho001 template Program Notes Typecho

typecho001 template template please do not modify the folder name of this template. The folder name is: typecho001 1.4 Fix the js output problem on the article page 1.3 Fix the error prompt when the plug-in is not installed Optimize the list page code output 1.2 Fix the comment function and add a custom homepage title 1.1 Fix the comment reply asymmetry function Add a separate title setting function on the homepage Add the website favicon.ico icon Add one...
👁 198
Cultural Media Event Planning and Performance Website Template 1126

Cultural Media Event Planning and Performance Website Template 1126 Practical Collection Yiyou template

This EyouCMS template is ideal for the culture, media, event planning, and entertainment industries. Its creative and artistic design style is perfect for showcasing cultural projects, media services, event activities, case studies, and brand identities. It helps cultural and media companies effectively demonstrate their capabilities online and attract potential partners. Template Display | Installation Instructions | Website Backend: /login.php | Username: admin | Password: admin | Related Articles: Common Questions Regarding EyouCMS Installation...
👁 37
Modification of typecho paging style

Modification of typecho paging style Program Notes Typecho

Sir, times have changed! Typecho is currently the most perfect solution, because Baidu can only see the code of fixed thinking. The actual generated HTML code is breathtakingly clean and fully customized, including adding classes to the li element, adding classes to the a element, adding classes to the previous page and next page, and removing the li tags that come with typecho to express more. I can even add some text to the content inside...
👁 517