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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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.


                <div id="app">
  <div class="card-row">
      v-for="(card, index) in cards" 
      <img class="card-image" :class="{'selected': isSelected(index)}"
      <div class="card-footer">
        <p class="card-text">RECIPE</p>
        <h3 class="card-title">{{card.title}}</h3>
        <p class="card-text">by 
          <span class="card-author" :class="{'selected': isSelected(index)}">{{}}</span>


                body {
  background-color: #E1E7E7;

.card-row {
  display: flex;
  justify-content: center;
  align-items: center;  
  min-width: 780px;
  width: 100%;
  height: 500px;

.card {
  position: relative;
  background-color: #FFFFFF;
  height: 370px;
  width: 240px;
  margin: 10px;
  overflow: hidden;
  box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.5);
  transition: height 0.3s, box-shadow 0.3s;

.card:hover {
  height: 410px;
  box-shadow: 20px 20px 40px 0px rgba(0,0,0,0.5);

.card-image {
  /* center horizontally overflown image */
  position: absolute;
  left: -9999px;
  right: -9999px;
  margin: auto;

  height: 220px;
  min-width: 100%;
  transition: height 0.3s, opacity 0.3s;
.card-image.selected {
  height: 410px;
  opacity: 0.3;
.card-footer {
  position: absolute;
  bottom: 0;
  height: 130px;
  padding: 10px 15px;
  font-family: Helvetica;

.card-text {
  font-size: 14px;
  color: rgba(0, 0, 0, 0.7);
.card-title {
  font-family: Serif;
.card-author {
  font-size: 14px;
  color: #BAB096;
  transition: color 0.3s;
.card-author.selected {
  color: #6a6456;


                const cards = [
  {title: 'Gooey PBJ Brownies', author: 'John Walibur', image: ''},
  {title: 'Crisp Spanish Tortilla Matzo Brei', author: 'Colman Andrews', image: ''},
  {title: 'Grilled Shrimp with Lemon and Garlic', author: 'Celeste Mills', image: ''}

new Vue({
  el: '#app',
  data: {
    cards: cards,
    selectedCard: -1
  methods: {
    hoverCard(selectedIndex) {
      this.selectedCard = selectedIndex
    animateCards () {, index) => {
        const direction = this.calculateCardDirection(index, this.selectedCard)
          {x: direction * 50}
    calculateCardDirection (cardIndex, selectedIndex) {
      if(selectedIndex === -1) {
        return 0
      const diff = cardIndex - selectedIndex
      return diff === 0 ? 0 : diff/Math.abs(diff)
    isSelected (cardIndex) {
      return this.selectedCard === cardIndex