Time for action – flipping a card with CSS3
We are going to start a new project and create a card-flipping effect when we click on the playing card:
- Let's continue with our previous code example.
- The card now contains two faces: a front face and a back face. Replace the following code in the
body
tag in the HTML code:<section id="game"> <div id="cards"> <div class="card"> <div class="face front"></div> <div class="face back cardAK"></div> </div> <!-- .card --> <div class="card"> <div class="face front"></div> <div class="face back cardAQ"></div> </div> <!-- .card --> </div> <!-- #cards --> </section> <!-- #game --> <script src="js/jquery-2.1.3.min.js"></script>
- Then, create a new
css3flip.css
file in thecss
folder to test the flipping effect. - In ...
Get HTML5 Game Development by Example : Beginner's Guide - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.