cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

            
              <div id="app">
  <img src="https://vignette2.wikia.nocookie.net/ssb/images/f/f6/SF_Logo.png/revision/latest?cb=20150614010256" class="logo" />
  <div class="character">
    <div class="columns">
      <div class="column is-centered">
        <div class="parent columns">
          <div class="column">
            <div class="character__profile">
              <img :src="getActiveCharacter.largeImg" />
            </div>
          </div>
          <div class="column has-text-left">
            <div class="character__stats">
              <div class="name">{{getActiveCharacter.name}}</div>
              <div class="stat">
                <span class="tag">Height</span> {{getActiveCharacter.height}}
              </div>
              <div class="stat">
                <span class="tag">Birthplace</span>
                <i v-if="getActiveCharacter.birth" class="flag"
                   :class="`famfamfam-flag-${getActiveCharacter.birth}`"></i>
                <span v-else>?</span>
              </div>
              <div class="stat">
                <span class="tag">Fighting Style</span>
                {{getActiveCharacter.fighting}}
              </div>
              <div class="stat">
                <span class="tag">Skills</span>
                {{getActiveCharacter.skills}}
              </div>
              <div class="stat final">
                <span class="tag">Alignment</span>
                <span class="alignment"
                      :class="getCharacterAlignment">{{getActiveCharacter.alignment}}</span>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
  <div class="character-container">
    <div class="columns is-centered is-mobile is-gapless">
      <div class="column" v-for="character in characters.slice(0,5)">
        <character-component :character="character" />
      </div>
    </div>
    <div class="columns is-centered is-mobile is-gapless">
      <div class="column" v-for="character in characters.slice(5,10)">
        <character-component :character="character" />
      </div>
    </div>
  </div>
  <a href="https://twitter.com/djirdehh" target="_blank" class="twitter-section">
    <i class="fa fa-twitter-square" aria-hidden="true"></i>
  <a>
</div>
    
<!--  Prefetch large images -->
<link rel="prefetch" href="https://s3-us-west-2.amazonaws.com/s.cdpn.io/1211695/ken-compressed.png" />
<link rel="prefetch" href="https://s3-us-west-2.amazonaws.com/s.cdpn.io/1211695/chun_li-compressed.png" />
<link rel="prefetch" href="https://s3-us-west-2.amazonaws.com/s.cdpn.io/1211695/dj-compressed.png" />
<link rel="prefetch" href="https://s3-us-west-2.amazonaws.com/s.cdpn.io/1211695/cammie-compressor.png" />
<link rel="prefetch" href="https://s3-us-west-2.amazonaws.com/s.cdpn.io/1211695/sagat-compressed.png" />
<link rel="prefetch" href="https://s3-us-west-2.amazonaws.com/s.cdpn.io/1211695/zangief-compressed.png" />
<link rel="prefetch" href="https://s3-us-west-2.amazonaws.com/s.cdpn.io/1211695/akuma_compressed.jpg" />
<link rel="prefetch" href="https://s3-us-west-2.amazonaws.com/s.cdpn.io/1211695/bison-compressor.png" />
<link rel="prefetch" href="https://s3-us-west-2.amazonaws.com/s.cdpn.io/1211695/blanka_compressed.png" />

            
          
!
            
              @import url('https://fonts.googleapis.com/css?family=Russo+One');

$fontFamily: 'Russo One', sans-serif;

$small: 520px;
$medium: 768px;
$large: 1216px;

html, body, #app {
  height: 100%;
  background: linear-gradient(to bottom ,#015492,#010134);
}

.logo {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  margin: auto;
}

.character {
  height: 100%;
  overflow: hidden;
}

.character .columns {
  height: 100%;
  display: flex;
  align-items: center;
}

.character .parent.columns {
  min-width: 1000px;
}
.character .column {
  display: flex;
  justify-content: center; 
 }

.character__profile {
  max-width: 400px;
  position: relative;
  
  img {
    max-height: 550px;
  }
}

.character__stats {
  width: 100%;
  font-family: $fontFamily;
  position: relative;
  bottom: 35px;

  .name {
    font-size: 40px;
    color: #FFF;
    font-family: $fontFamily;
    text-shadow: 0 0 3px yellow;
    text-transform: uppercase;
  }
  
  .stat {
    padding: 3px 0;
    color: #FFF;
  }
  
  .stat.final {
    padding-top: 30px;
  }

  .tag {
    background-color: yellow;
  }
  
  .flag {
    transform: scale(1.5);
    margin-left: 3px;
  }
  
  .alignment {
    font-size: 22.5px;
    text-shadow: 0 0 1px white;
    position: relative;
    top: 2.5px;
  }
  
  .alignment.good {
    color: #01ff2c;
  }
  
  .alignment.evil {
    color: #f52808;
  }
}

.character-container {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 20px;
  margin: auto;
  .columns.is-gapless:not(:last-child) {
    margin-bottom: 0;
  }

  .column {
    max-width: 71.5px;
  }
  
  .character-box {
    filter: grayscale(1);
    margin-bottom: 2px;
    height: 80px;
    outline: 2px solid gray;
    align-self: stretch;
    cursor: pointer;
    position: relative;
    text-align: center;

    .character-img, .character-name {
			margin: 0;
			padding: 0;
		}
    
    .character-img {
      height: 100%;
    }

    .character-name {
			transform: translateY(-3em);
			display: none;
		}
  }

  .character-box.active {
    filter: grayscale(0);
    outline: 2px solid yellow;
    z-index: 99;
    animation: flash 300ms linear; 
    
    .character-name {
      display: block;
      background-color: rgba(227,35,30,0.7);
      color: white;
      margin-top: .8em;
      font-size: .55em;
      text-transform: uppercase;
      font-weight: 700;
      padding: .05em 0;
    }
  }
}

.twitter-section {
  position: absolute;
  right: 10px;
  bottom: 10px;
  
  .fa-twitter-square {
    color: #f52808;
    font-size: 30px;
  }
}

@keyframes flash {
	0% {
		filter:brightness(100%);
	}
	20% {
		filter:brightness(150%);
	}
	40% {
		filter:brightness(100%);
	}
	60% {
		filter:brightness(150%);
	}
	80% {
		filter:brightness(100%);
	}
	100% {
		filter:brightness(150%);
	}
}

@media(max-width: $large) and (max-height: $medium) {
  .character__profile img {
    max-height: 325px;
    position: relative;
    right: 40px;
  }

  .character-container .column {
    max-width: 48px;
  }
  
  .character-container .character-box {
    height: 53.5px;
  }
  
  .character__stats .stat.final {
    padding-top: 0;
  }
}

            
          
!
            
              const characters = [
  {
    id: 'ryu',
    name: 'Ryu',
    smallImg: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/1211695/ryu_headshot_compressed.jpg',
    largeImg: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/1211695/ryu_compressed.png',
    height: '5"9',
    birth: 'jp',
    fighting: 'Ansatsuken',
    skills: 'Sleeping anywhere',
    alignment: 'Good',
    alignmentType: 'good',
    active: true,
  },
  {
    id: 'ken',
    name: 'Ken',
    smallImg: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/1211695/ken_headshot_compressed.jpg',
    largeImg: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/1211695/ken-compressed.png',
    height: '5"9',
    birth: 'us',
    fighting: 'Ansatsuken',
    skills: 'Cooking pasta',
    alignment: 'Good',
    alignmentType: 'good',
    active: false,
  },
  {
    id: 'chun_li',
    name: 'Chun-Li',
    smallImg: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/1211695/chun_li_headshot_compressed.jpg',
    largeImg: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/1211695/chun_li-compressed.png',
    height: '5"6',
    birth: 'cn',
    fighting: 'Chinese martial arts',
    skills: 'Shooting',
    alignment: 'Lawful Good',
    alignmentType: 'good',
    active: false,
  },
  {
    id: 'dee_jay',
    name: 'Dee Jay',
    smallImg: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/1211695/dj_headshot_compressed.jpg',
    largeImg: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/1211695/dj-compressed.png',
    height: '6"1',
    birth: 'jm',
    fighting: 'Kickboxing',
    skills: 'Bamboo dancing',
    alignment: 'Good',
    alignmentType: 'good',
    active: false,
  },
  {
    id: 'cammy',
    name: 'Cammy',
    smallImg: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/1211695/cammy_headshot_compressed.jpg',
    largeImg: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/1211695/cammie-compressor.png',
    height: '5"5',
    birth: 'gb',
    fighting: 'Shadaloo/Special Forces Training',
    skills: 'Knife throwing',
    alignment: 'Good/Lawful Neutral',
    alignmentType: 'good',
    active: false,
  },
  {
    id: 'sagat',
    name: 'Sagat',
    smallImg: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/1211695/sagat_headshot_compressed.jpg',
    largeImg: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/1211695/sagat-compressed.png',
    height: '7"5',
    birth: 'th',
    fighting: 'Muay Thai',
    skills: 'Breathing underwater',
    alignment: 'Neutral',
    alignmentType: 'neutral',
    active: false,
  },
  {
    id: 'zangief',
    name: 'Zangief',
    smallImg: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/1211695/zangief_headshot_compressed.jpg',
    largeImg: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/1211695/zangief-compressed.png',
    height: '7"0',
    birth: 'ru',
    fighting: 'Russian/American Pro Wrestling',
    skills: 'Resistance to cold',
    alignment: 'Evil',
    alignmentType: 'evil',
    active: false,
  },
  {
    id: 'akuma',
    name: 'Akuma',
    smallImg: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/1211695/akuma_headshot_compressed.jpg',
    largeImg: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/1211695/akuma_compressed.jpg',
    height: '5"10',
    birth: 'jp',
    fighting: 'Satsui no Hado/Ansatsuken',
    skills: 'Martial Arts',
    alignment: 'Neutral Evil',
    alignmentType: 'evil',
    active: false,
  },
  {
    id: 'bison',
    name: 'Bison',
    smallImg: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/1211695/bison_headshot_compressed.jpg',
    largeImg: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/1211695/bison-compressor.png',
    height: '6"0',
    birth: undefined,
    fighting: 'Psycho Power',
    skills: 'Hypnosis',
    alignment: 'Evil',
    alignmentType: 'evil',
    active: false,
  },
  {
    id: 'blanka',
    name: 'Blanka',
    smallImg: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/1211695/blanka_headshot_compressed.jpg',
    largeImg: 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/1211695/blanka_compressed.png',
    height: '6"4',
    birth: 'br',
    fighting: 'Feral movement, electric attacks',
    skills: 'Hunting',
    alignment: 'Good',
    alignmentType: 'good',
    active: false,
  },
]

Vue.component('character-component', {
  template: `
    <div class="character-box"
         :class="[{ 'active': character.active }]" @click="setActive(character.id)">
      <img class="character-img" :src="character.smallImg" />
      <p class="character-name">{{character.name}}</p>
    </div>
  `,
  props: {
    character: Object
  },
  methods: {
    setActive() {
      characters.map((character) => {
        character.active = this.character.id === character.id;
      });
    }
  }
})

new Vue({
  el: '#app',
  data: {
    activeCharacter: {},
    characters
  },
  computed: {
    getActiveCharacter() {
      return this.filterCharacters();
    },
    getCharacterAlignment() {
      const activeCharacter = this.filterCharacters();
      return activeCharacter.alignmentType;
    }
  },
  methods: {
    filterCharacters() {
      return this.characters.find(character => {
        return character.active;
      });
    }
  }
});

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console