Flip Business Card using HTML, CSS & JavaScript




Hello developers, today in this blog, you'll learn to create a Flip Business Card using HTML, CSS & JavaScript.

A card is a small rectangular box with images and text. The user can learn many details. To maintain the usability of the website interface, the card UI pattern is a default choice. Because cards are easy to use, they can also show content that contains different details.

In this blog (Flip Business Card) on the webpage, there is a card at the center of the page. The card contains two sides, the front, and the back part. The front side of the card contains the image, and when you hover over the card the name and the destination of the person will pop, and when you click, it will flip to the back card containing some text. At first, the front card contains an image that would be made visible. When you click on that image, this card flip or rotates horizontally and show you the back part of the card.

The source code of this Flip Business Card is given below, if you want the source code of this program, you can copy it. You can use this Flip Business Card with your creativity and can take this project to the next level.

Flip Business Card [Source Code]

To make this website, you would like to make three files: an HTML file, a CSS file & a JavaScript file. First, create an HTML file with the name index.html and remember, you have to create a file with a .html extension.

<!DOCTYPE html> <html> <head> <title>Flip Business Card || Learningrobo</title> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <div class="content"> <div class="container"> <div class="card"> <figure class="front"> <img src="https://cdn.pixabay.com/photo/2016/11/23/14/45/coding-1853305__340.jpg" alt="front"> <div class="caption"> <h2>Christ Jennifer</h2> <p>Web Developer</p> </div> </figure> <figure class="back"> <img src="https://cdn.pixabay.com/photo/2016/07/06/13/21/office-1500461__340.jpg" alt="back"> <div class="caption"> <dl> <dt>Phone:</dt> <dd>9876543210</dd> <dt>Email:</dt> <dd>jennifer@gmail.com</dd> <dt>Web:</dt> <dd>www.jenniferdev.com</dd> </dl> </div> </figure> </div> </div> <div class="credit">Made with <span style="color:tomato;font-size:20px;">❤ </span>by<a href="https://www.learningrobo.com/"> Learning Robo</a></div> </div> <script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js'></script> <script type='text/javascript' src='script.js'></script> </body> </html>
CSS provides style to an HTML page. To make the page attractive, create a CSS file with the name style.css, and remember that you have to make a file with a .css extension.


@import url(https://fonts.googleapis.com/css?family=Raleway:400,300,800);
@import url(https://fonts.googleapis.com/css?family=Lato:300,700);
*{
  box-sizing:border-box;
}
html, body{
  width:100%;
  height:100%;
}
body{
  background: #eee;
  font-weight: 400;
  font-size: 1em;
  font-family: 'Raleway', Arial, sans-serif;
}

.container, figure{
  width:450px;
  height: 270px;
}

.container{
  position:absolute;
  perspective:1000;
  margin-top:-135px;
  top:50%;
}

.card{
  position: relative;
  transition: 0.6s;
  transform-style: preserve-3d;
}

figure{
  background: #2e5d5a;
  color: #fff;
  backface-visibility: hidden;
  overflow: hidden;
  position: absolute;
  top: 0;
  left: 0;
  text-align: center;
  cursor: pointer;
  transition: 0.6s;
  transform-style: preserve-3d;
  box-shadow: 0 1px 5px rgba(0,0,0,0.9);
}

figure.front{
  transform: rotateY(0deg);
  z-index: 2;
}

figure.back,
.card.flipped{
  transform: rotateY(180deg);
}

figure img{
  position: relative;
  display: block;
  min-height: 100%;
  opacity: 0.7;
}

figure .caption {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 2em;
  backface-visibility: hidden;
}

.front .caption{
  font-size: 1.25em;
}

.front .caption:before {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(rgba(72,76,97,0) 0%, rgba(72,76,97,0.8) 75%);
  content: '';
  opacity: 0;
  transform: translate3d(0,50%,0);
  transition: opacity 0.35s, transform 0.35s;
}

.front:hover .caption:before{
  opacity: 1;
  transform: translate3d(0,0,0);
}

.front h2{
  word-spacing: -0.15em;
  font-weight: bold;
  font-size: 1.6em;
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  color: #fff;
  transition: transform 0.35s, color 0.35s;
  transform: translate3d(0,-50%,0);
}

.front h2:after{
  position: absolute;
  bottom: -10px;
  left: 70px;
  right: 70px;
  height: 2px;
  background: #ffff00;
  content: '';
  transition: transform 0.35s;
  transform: translate3d(-130%,0,0);
}

.front:hover h2 {
  color: #ffff00;
  -webkit-transform: translate3d(0,-50%,0) translate3d(0,-40px,0);
  transform: translate3d(0,-50%,0) translate3d(0,-40px,0);
}

.front:hover h2:after {
  transform: translate3d(0,0,0);
}

.front p {
  letter-spacing: 1px;
  font-size: 68.5%;
  position: absolute;
  bottom: 0;
  left: 0;
  padding: 2em;
  width: 100%;
  opacity: 0;
  transform: translate3d(0,10px,0);
  transition: opacity 0.35s, transform 0.35s;
}

.back .caption:before,
.back .caption:after{
  position: absolute;
  top: 30px;
  right: 30px;
  bottom: 30px;
  left: 30px;
  content: '';
  opacity: 0;
  transition: opacity 0.45s, transform 0.45s;
  transition-delay: 1s;
}

.back .caption:before{
  border-top: 1px solid #ffff00;
  border-bottom: 1px solid #ffff00;
  transform: scale(0,1);
}

.back .caption:after{
  border-right: 1px solid #ffff00;
  border-left: 1px solid #ffff00;
  transform: scale(1,0);
}

.card.flipped .back .caption:before,
.card.flipped .back .caption:after {
  opacity: .9;
  transform: scale(1);  
}

.back dl{
  font-family:'Lato', Arial, sans-serif;
  font-weight:550;
  bottom:70px;
  left:80px;
  position: absolute;
  opacity: 0;
  transition: opacity .35s, transform .35s;
  transition-delay: .85s;
  transform: translate3d(-40px,0,0);
}

.card.flipped .back dl {
  opacity: 1;
  transform: translate3d(0,0,0);
}

dd{
  color: #ffff00;
}

dl dt{
  float: left;
  width: 60px;
  overflow: hidden;
  clear: left;
  text-align: right;
  font-weight:700;
}

dl dd{
  margin-left: 80px;
  text-align:left;
}

dl dd:before,
dl dd:after{
  display: table;
  content: " ";
}

dl dd:after{
  clear: both;
}

.front:hover p {
  opacity: 1;
  transform: translate3d(0,0,0);
}

figure a{
  z-index: 1000;
  text-indent: 200%;
  white-space: nowrap;
  font-size: 0;
  opacity: 0;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}
.credit a {
    text-decoration: none;
    color: #000;
    font-weight: 800;
}

.credit {
    text-align: center;
    font-family: Verdana,Geneva,Tahoma,sans-serif;
}
@media (min-width: 450px) {
  .container{
    left: 50%;
    margin-left:-225px;
  }
}
JavaScript makes the page work functionally. At last, create a JavaScript file with the name script.js, and remember that you've got to make a file with a .js extension.


$('.card').click(function(){
  $(this).toggleClass('flipped');
});
We hope you will like this Flip Business Card using HTML, CSS & JavaScript.

Thank you for reading our blog. If you face any problem creating this Flip Business Card using HTML, CSS & JavaScript then contact us or comment to us. We'll try to provide a solution to your problem as soon as possible.

Thank you
Learning robo team

إرسال تعليق

Thank you
Learning robo team

Post a Comment (0)

أحدث أقدم
Learning Robo says...
code copied
Welcome