FlipcardTutorials

How to create a CSS FLIP CARD

How to create a CSS FLIP CARD

How to create a CSS FLIP CARD

Before We Start

Every developer needs clean and modern elements to develop their websites, It contains pictures and a user interface element within a website. The most important one and the first section that the user sees when the user enters a website. How to create a CSS FLIP CARD

So if you are a person who wishes to develop a website, you have to know how to create that properly.

How to create a CSS FLIP CARD

We are here to solve your problem. In this article we discuss how to create these elements. Before we start please read the below articles which easier you to understand the process, if you are new to development.

Step 1 – Add HTML

It’s too easy and simple. Just copy and paste below code in your HTML editor between <body> </body> tag.

<h1>CSS-FLIP-CARD</h1>
    <div class="card">
      <div class="card__inner">
        <div class="card__content card_content--front">
          <h2>FRONT</h2>
        </div>
        <div class="card__content card__content--back">
          <h2>BACK</h2>
        </div>
      </div>
    </div>
    <h3>by W3schoolweb</h3>

Step 2 – Add CSS

Copy and paste below code in your HTML editor between <style></style> tag.

<style>
* {
    margin: 0;
    padding: 0
}

body {
    font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
    color: #FFFFFF;
    background: #41295a;
    /* fallback for old browsers */
    background: -webkit-linear-gradient(to right, #2F0743, #41295a);
    /* Chrome 10-25, Safari 5.1-6 */
    background-color: #FBAB7E;
background-image: linear-gradient(62deg, #FBAB7E 0%, #F7CE68 100%);

    /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
    display: flex;
    height: 100vh;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.card {
    cursor: pointer;
    margin: 50px;
    border-radius: 3px;
    perspective: 1000px;
}

.card__inner {
    background-color: #FFFFFF;
    color: #41295a;

    height: 350px;
    width: 300px;
    
    display: flex;
    justify-content: center;
    align-items: center;
    
    transition: transform 0.8s;
    transform-style: preserve-3d;
}

.card:hover .card__inner {
    transform: rotateY(180deg);
}

.card__content {
    position: absolute;
    -webkit-backface-visibility: hidden; /* Safari */
    backface-visibility: hidden;
}

.card__content--back {
  transform: rotateY(180deg);
} 
</style>

At the end we will have something like this. You can change fonts, colors, backgrounds and all things that you want. Enjoy it.

Your Output

How to create a CSS FLIP CARD

Video Tutorial

Please watch this video to better understand this tutorial and don’t forget to subscribe to our channel.


Help others to find out about this article on Social Media sites. If you have any doubt or any problem, don’t hesitate to contact us. Thereafter we will be able to help you and also make sure you bookmark our site on your browser.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button