Pen Settings

HTML

CSS

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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

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.

HTML

              
                <div id="app"></div>
              
            
!

CSS

              
                body {
  background-color: #0C0C0C;
  font-family: 'Noto Sans', sans-serif;
}

$card-size: 12rem;
$flip-duration: 1s;
$perspective: 15rem;
$degree: 90deg;
.Card {
  margin: 1rem;
  display: inline-block;
  cursor: pointer;
  
  .Card-Front,
  .Card-Back {
    width: $card-size;
    height: $card-size;
    text-align: center;
    margin-bottom: -$card-size / 2;
    
    p {
      margin: 0;
      padding: 0.5rem;
    }
    h3 {
      padding: 0 2rem;
      position: relative;
      top: 2rem;
    }
  }
  
  .Card-Front {
    position: relative;
    z-index: 1;
    color: #69969C;
    background-color: #0E464E;
    
    // Animations
    &.Card-Back-Flip {
      animation: back-flip-1 $flip-duration 1 forwards;
      @keyframes back-flip-1 {
        0% {transform: rotateY(0deg); z-index: 1}
        50% {transform: rotateY($degree) perspective($perspective); z-index: 1}
        100% {transform: rotateY($degree); z-index: -1}
      }
    }
    
    &.Card-Front-Flip {
      animation: front-flip-1 $flip-duration 1 forwards;
      @keyframes front-flip-1 {
        0% {transform: rotateY(-$degree); z-index: -1}
        50% {transform: rotateY(-$degree) perspective($perspective); z-index: -1}
        100% {transform: rotateY(0deg); z-index: 1}
      }
    }
  }
  
  .Card-Back {
    font-size: 0.9rem;
    position: relative;
    z-index: -1;
    top: -$card-size / 2;
    color: #012E34;
    background-color: #69969C;
    
    // Animations
    transform: rotateY(-$degree); 
    &.Card-Back-Flip {
      animation: back-flip-2 $flip-duration 1 forwards;
      @keyframes back-flip-2 {
        0% {z-index: -1}
        50% {transform: rotateY(-$degree) perspective($perspective); z-index: -1}
        100% {transform: rotate(0deg); z-index: 1}
      }
    }
    
    &.Card-Front-Flip {
      animation: front-flip-2 $flip-duration 1 forwards;
      @keyframes front-flip-2 {
        0% {transform: rotate(0deg); z-index: 1}
        50% {transform: rotateY($degree) perspective($perspective); z-index: 1}
        100% {transform: rotateY($degree); z-index: -1}
      }
    }
  }
}

.Cards {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  
  .Card:nth-child(2n+2) {
    .Card-Front { background-color: #804815; color: #FFD3AA; }
    .Card-Back { background-color: #D49D6A; color: #012E34; }
  }
  .Card:nth-child(3n+3) {
    .Card-Front { background-color: #801D15; color: #FFB0AA; }
    .Card-Back { background-color: #FFB0AA; color: #012E34; }
  }
  .Card:nth-child(4n+4) {
    .Card-Front { background-color: #805E15; color: #FFE4AA; }
    .Card-Back { background-color: #FFE4AA; color: #012E34; }
  }
}
              
            
!

JS

              
                var Card = React.createClass({
  getInitialState: function() {
    return {
      flipped: false,
      clicked: false
    }
  },
  flip: function() {
    this.setState({
      flipped: !this.state.flipped,
      clicked: true
    });
  } ,
  render: function() {
    var flippedCSS = this.state.flipped ? " Card-Back-Flip" : " Card-Front-Flip";
    if (!this.state.clicked) flippedCSS =  "";
    return (
      <div className="Card" onClick={this.flip}>
        <div className={"Card-Front"+flippedCSS}>
          <h3>{this.props.title}</h3>
        </div>
        <div className={"Card-Back"+flippedCSS}>
          {this.props.children}
        </div>
      </div>
    );
  }
});
// End of Components

let app = (
  <div className="Cards">
    <Card title="Mallem">
      <p>
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Tempore dolores facilis perspiciatis. Excepturi temporibus laborum odio possimus error.
      </p>
    </Card>
    <Card title="Hbibi">
      <p>
      Pariatur repellat corporis itaque veniam officiis accusamus commodi consequuntur at, natus quia quod laudantium ea molestias facilis ullam. Veritatis, magnam expedita rem.
      </p>
    </Card>
    <Card title="Khorosho">
      <p>
      Maiores nihil velit provident rem sapiente dolores ullam, magnam sint enim et necessitatibus nobis amet labore modi, deserunt, tempore quisquam. Harum, perspiciatis.
      </p>
    </Card>
    <Card title="Hao Tian">
      <p>
      Porro, iure? Aspernatur quo vel quod, illo natus possimus inventore id tempora? Delectus facere magni a aliquid error, ex voluptate aliquam aut.
      </p>
    </Card>
    <Card title="Fisken">
      <p>
      Harum error quibusdam eveniet, qui obcaecati sunt. Minus facere consectetur nemo aliquam, assumenda rerum, a repudiandae? Provident ipsa similique recusandae impedit cum.
      </p>
    </Card>
    <Card title="Poydyom">
      <p>
      Magnam suscipit necessitatibus nisi asperiores, quis corporis voluptatem ut fugit eveniet blanditiis accusamus quam delectus amet debitis ea consequuntur veritatis. Numquam, suscipit.
      </p>
    </Card>
    <Card title="Kore">
      <p>
      Lorem ipsum dolor sit amet, consectetur adipisicing elit. Tempore dolores facilis perspiciatis. Excepturi temporibus laborum odio possimus error.
      </p>
    </Card>
    <Card title="Shihou">
      <p>
      Ipsa harum, non, possimus illo dolor commodi expedita officia amet. Nostrum laborum cum maxime distinctio perspiciatis ex architecto. Tenetur, alias perferendis dolores.
      </p>
    </Card>
    <Card title="Wallah">
      <p>
      Magnam suscipit necessitatibus nisi asperiores, quis corporis voluptatem ut fugit eveniet blanditiis accusamus quam delectus amet debitis ea consequuntur veritatis. Numquam, suscipit.
      </p>
    </Card>
    <Card title="Anate">
      <p>
      Porro, iure? Aspernatur quo vel quod, illo natus possimus inventore id tempora? Delectus facere magni a aliquid error, ex voluptate aliquam aut.
      </p>
    </Card>
  </div>
);

ReactDOM.render(app, document.getElementById('app'))
              
            
!
999px

Console