Skip to main content

Flip Card on Click no JavaScript

 


Flip card via HTML and CSS only. Short and simple, click on the the card below the see the animation.

DEMO

HTML

<label>
    <input type="checkbox"  />
    <div class="card">
        <article class="front">Front</article>
        <article class="back">Back</article>
    </div>
</label>

CSS

label {
  -webkit-perspective: 1000px;
  perspective: 1000px;
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  display: block;
  width: 250px;
  height: 200px;
  cursor: pointer;
}

.card {
  position: relative;
  height: 100%;
  width: 100%;
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  -webkit-transition: all 600ms;
  transition: all 600ms;
  z-index: 20;
  border-radius: 10px;
}

.card article {
  position: absolute;
  height: 100%;
  width: 100%;
  background: CadetBlue;
  color: white;
  text-align: center;
  line-height: 200px;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 10px;
}

.card .back {
  background: DarkBlue;
  -webkit-transform: rotateX(180deg);
  transform: rotateX(180deg);
}

label:hover .card {
  -webkit-transform: rotateX(20deg);
  transform: rotateX(20deg);
  box-shadow: 0 20px 20px rgba(50, 50, 50, 0.2);
}

input {
  display: none;
}

:checked + .card {
  transform: rotateX(180deg);
  -webkit-transform: rotateX(180deg);
}

label:hover :checked + .card {
  transform: rotateX(160deg);
  -webkit-transform: rotateX(160deg);
  box-shadow: 0 20px 20px rgba(255, 255, 255, 0.2);
}

Comments

Popular posts from this blog

Introduction

Hello world,  UIUX Component  is for those who newbie in HTML, CSS and JavaScript for their new career as Web Designer, Web Developer, Web Editor etc. We try our best to make sure we update the code which applicable for your daily routine in web development or maybe some for Apps content.  To utilise this site you should have basic knowledge on HTML, CSS and JavaScript. If you still not sure what we talking about, we have a few suggestion on where you should to start your knowledge. What is HTML HTML stands for Hyper Text Markup Language, the standard markup language for creating Web pages. Describes the structure of a Web page, consists of a series of elements which elements tell the browser how to display the content also elements label pieces of content such as "this is a heading", "this is a paragraph", "this is a link", etc. HTML Tutorial What is CSS CSS stands for Cascading Style Sheets, describes how HTML elements are to be displayed on screen, pape...

Audio Player - HTML

The HTML <audio> element is used to play an audio file, here are three supported audio formats MP3, WAV, and OGG for Safari OGG is not supported for now. DEMO Your browser does not support HTML audio. HTML < audio controls > < source src = "https://actions.google.com/sounds/v1/cartoon/crazy_dinner_bell.ogg" type = "audio/ogg" > < p > Your browser does not support HTML audio .</ p > </ audio > Muted < audio controls muted > < source src = "https://actions.google.com/sounds/v1/cartoon/crazy_dinner_bell.ogg" type = "audio/ogg" > < p > Your browser does not support HTML audio .</ p > </ audio >

Native Accordion - HTML

  Use details element to create native accordion, is so simple and effective without javascript. Tap here to see more details Lorem ipsum dolor sit amet consectetur adipisicing elit. Ut eum perferendis eius. Adipisci velit et similique earum quas illo odio rerum optio, quis, expedita assumenda enim dicta aliquam porro maxime minima sed a ullam, aspernatur corporis. Debitis nemo dolores sit in nihil vero, necessitatibus eveniet labore velit numquam voluptatibus quia. HTML < details > < summary > Tap here to see more details </ summary > < article > Lorem ipsum dolor sit amet consectetur adipisicing elit . Ut eum perferendis eius . Adipisci velit et similique earum quas illo odio rerum optio, quis, expedita assumenda enim dicta aliquam porro maxime minima sed a ullam, aspernatur corporis . Debitis nemo dolores sit in nihil vero, necessitatibus eveniet labore velit numquam voluptatibus qui...