Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <button onClick="throwCard()">Throw random card!</button>
<div id="path" class="path">
  <div id="samplecard" class="card rank13 spades">
    <div class="face"/></div>

<div class="banner-article">
  <a href="" target="_blank"><div class="container-image"><img src=""></div>
    <span> Read Full Article Here</span></a>


                /* ANIMATION CSS */

.card {
    /* out of screen: translateY viewport height */
    transform: translateY(100vh) scale(1.5);
    box-shadow: 21px 21px 14px -9px rgba(0,0,0,1);

.card.thrown {
    transition: all 1s ease-in-out;
    /* back on screen: translateY to a lower level */
    transform: translateY(10vh) scale(1);
    box-shadow: 8px 8px 14px -9px rgba(0,0,0,1);

.path {
    height: 200vh;
    position: absolute;
    bottom: -120vh;
    left: 50%;

/* AUX CSS */

I'm using these amazing project for the cards:

which is using:

body {
  height: 100%;
  margin: 0;
  padding: 0;

body {
    background-image: url("");
    overflow: hidden;

.card {
    margin: 0 auto; 

button {
  color: white;
  border: 0;
  padding: 10px;
  margin-left: 10px;

/* this sets the card size */
html {
    font-size: 40px;
    font-family: 'Roboto', sans-serif;

/* Article Link */
@import url(',500');

.banner-article {
  position: absolute;
  bottom: 30px;
  right: 30px; 

.banner-article a {
  display: flex;
  align-items: center;
  flex-direction: column;

.banner-article .container-image {
  background-color: #fff;
  border-radius: 50%;
  width: 70px;
  height: 70px;
  margin-bottom: 5px;
  display: flex;
  justify-content: center;
  align-items: center;

.banner-article img {
  width: 45px;
  position: relative;
  top: 3px;

a {
  color: #fff;
  font-size: 14px;
  text-decoration: none;
  font-weight: 500;


                function getRandomNumber(min, max) {
  return Math.floor(Math.random()*(max-min+1)+min)

function getRandomSuit() {
  var suits = ["hearts", "spades", "clubs", "diamonds"];
  return suits[getRandomNumber(0, 3)];

function getRandomCard() {
  return "rank" + getRandomNumber(1, 13) + " " + getRandomSuit();

function throwCard() {
  var cardElement = document.getElementById("samplecard");
  var pathElement = document.getElementById("path");
  // get a random card
  var card = getRandomCard();
  // place the card outside the viewport
  cardElement.className = "card " + card; = "";
  // add the class to start the animation
  setTimeout(function () {
    // Add new card info + 'thrown' class to start animation
    cardElement.className = "card thrown " + card;
    // Random path Rotation = "transform: rotate(" + getRandomNumber(-25,25) + "deg)";
    // Random thrown strength and card Rotation = "transform: translateY(" + getRandomNumber(0,30) + "vh) scale(1) rotate(" + getRandomNumber(-25,25) + "deg)";
  }, 100);