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

Packages

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.

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 id="information">
      <h1>ONCE UPON A TIME</h1>
      <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Exercitationem at quasi officiis sunt. Nemo ut, dolorem fuga quae velit ullam natus minima tenetur deleniti sequi voluptates minus temporibus accusantium incidunt.</p>
    </div>

    <div id="artwork">
      <div class="arttype-container">
        <transition name="fade">
          <p class="artwork-type" :key="currentArt" v-cloak>{{ currentArt }}</p>
        </transition>
      </div>

      <transition-group id="carousel" tag="div" name="slide">
        <img v-for="art in arts" :src="art.source" alt="" :key="art.type">
      </transition-group>
      <div id="btns">
        <button @click="prevArt">&lt;</button>
        <button @click="nextArt">&gt;</button>
     
        <transition name="fade">
          <p class="counter" :key="currentArt" v-cloak>{{ counter }} / 4</p>
        </transition>
      </div>
    </div>
  </div>
              
            
!

CSS

              
                
@import url('https://fonts.googleapis.com/css?family=Cinzel');

:root {
  --timing: 500ms;
  --img-width: 80vw;
  --outer-width: 100vw;
  --center-padding: calc((var(--outer-width) - var(--img-width)) / 2);
}

[v-cloak] {
  display: none;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
#app {
  width: 100vw;
  height: 100vh;
  overflow-x: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  font-family: 'Cinzel', serif;
}

#information {
  max-width: 100vw;
  padding: 1em;
  display: flex;
  flex-direction: column;
}

#information h1 {
  width: 60%;
  font-size: calc(18px + 2vw);
  color: hsl(0, 0%, 20%);
  font-weight: 100;
}

#information p {
  width: 70%;
  margin-left: 30%;
  margin-top: 1em;
  font-size: calc(10px + .5vw);
  color: hsl(0, 0%, 50%);
  font-family: sans-serif;
}

#artwork {
  display: grid;
  grid-template-rows: 1fr auto 1fr;
  justify-content: center;
}

.arttype-container {
  width: 100vw;
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  font-size: calc(20px + 2vw);
  color: hsl(0, 0%, 80%);
  padding: 0 var(--center-padding);
}

#carousel {
  display: flex;
  margin-left: var(--center-padding);
}

#carousel img {
  width: var(--img-width);
  margin-right: 10px;
  z-index: 2;
  box-shadow: 5px 5px 5px hsla(0, 0%, 0%, .5);
}

#btns {
  width: var(--img-width);
  margin-left: var(--center-padding);
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  padding: 1em 0;
  position: relative;
}

button {
  border: 1px solid #ccc;
  background: none;
  padding: .5em 1.5em;
  font-size: calc(12px + .2vw);
  position: relative;
}

.counter {
  color: hsl(0, 0%, 70%);
  position: absolute;
  right: 10px;
  margin-top: 0px;
  font-size: 12px;
  font-size: calc(12px + .1vw);
}

.fade-enter-active, .fade-leave-active {
  transition: opacity var(--timing);
  position: absolute;
}

.fade-enter, .fade-leave-to {
  opacity: 0;
}

.slide-enter-active {
  transition: var(--timing);
}

.slide-leave-active {
  position: absolute;
  z-index: 1;
  transition: var(--timing);
}

.slide-enter, .slide-leave-to {
  transform: scale(0.7);
}

.slide-move {
  transition: var(--timing);
}


@media (min-width: 700px) {
  :root {
    --img-width: 80vw;
  }
}

@media (min-width: 850px) {
  :root {
    --img-width: 70vw;
  }
}

@media (min-width: 950px) {
  :root {
    --img-width: 60vw;
    --outer-width: 70vw;
  }

  #app {
    grid-template-rows: 1fr;
    grid-template-columns: 30vw 70vw;
  }

  #information {
    justify-content: center;
  }

  #information h1 {
    width: 60%;
    font-size: calc(18px + 1.5vw);

  }

  #information p {
    width: 70%;
    margin-left: 30%;
    margin-top: 1em;
    font-size: calc(10px + .5vw);
  }

  #artwork {
    justify-content: start;
  }

  .arttype-container {
    width: var(--outer-width);
  }
}

              
            
!

JS

              
                new Vue({
  el: '#app',
  data: {
    arts: [
      {type: 'BAROQUE', source: 'https://www.artranked.com/images/6a/6af93dba7817800f2b64c8500d060f91.jpg'},
      {type: 'CUBISM', source: 'https://dg19s6hp6ufoh.cloudfront.net/pictures/612832317/large/7822312331410038.jpeg?1447190890'},
      {type: 'IMPRESSIONISM', source: 'https://i.pinimg.com/originals/5c/5f/8c/5c5f8c545ec59cb21c967fda401ed706.jpg'},
      {type: 'MODERNISM', source: 'https://content.gulbenkian.pt/wp-content/uploads/sites/5/2017/01/30154446/per-formare.jpg'},
    ],
    hidden: [],
    counter: 1,
  },

  methods: {
    nextArt() {
      if(this.arts.length > 1) {
        const hide = this.arts.shift();
        this.hidden.push(hide);
        this.counter++;
      }
    },
    prevArt() {
      if(this.hidden.length > 0) {
        const unhide = this.hidden.pop();
        this.arts.unshift(unhide);
        this.counter--;
      }
    },
  },
  
  computed: {
    currentArt() {
      return this.arts[0].type;
    }
  }
})
              
            
!
999px

Console