Flip cards are the cards in your website that will flip when you hover your mouse over them. There will be information, links or images in the back face of the card which will be visible when you hover over the cards.
In this article, you’re going to learn how to make Flip cards on your website using only HTML and CSS.
HTML file for card:
Decorating the front and back of the card using CSS: Built the structure of both faces of the card in the HTML part. Now we need to hide the back face initially. So we do that by backface-visibility: hidden property of CSS and this to the card-front and card-back classes so that when the front face is visible the back face is hidden and vice-versa. The key is to use the transform property of CSS and rotate the element by 180 degree i.e. transform: rotateY(180deg).
Note: You can rotate your cards as much as possible depending on the transform: rotateY(180deg). If you decrease the deg and increase the deg rotation is depending on that also you can flip the card vertically.
Example: This example uses transform: rotateY(180deg) property to flip/rotate the image. If you change the axis Y to X then cards will change the flip direction.
- How to create X and Y axis flip animation using HTML and CSS ?
- Bulma | Card
- How to design Responsive card-deck with fixed width in Bootstrap ?
- How to flip an image on hover using CSS ?
- Inline HTML Helper - HTML Helpers in ASP.NET MVC
- HTML Course | Structure of an HTML Document
- HTML | <html> xmlns Attribute
- HTML Course | Basics of HTML
- HTML | DOM HTML Object
- What is the difference between <html lang="en'> and <html lang="en-US'> ?
- HTML | <hr> Tag
- HTML | bdo Tag
- HTML | <dir> Tag
- HTML | <big> Tag
- HTML | <rtc> Tag
- HTML | <pre> Tag
- HTML tr Tag
- HTML | <kbd> Tag
- HTML | <!--...--> Tag
- HTML | <td> Tag
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.