Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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 class="container" id="my_view">
      <!-- <div v-show="ok" class="animated" transition="bounce"> -->
      <div class="animated">
        <h1>{{ origin.quote }}</h1>
        <div class="stripe"></div>
        <h2>{{ origin.author }}</h2>
      </div>
      <div class="buttons">
        <p>
          <button class="btn btn-default" aria-label="Settings" v-on:click="tweetThis()">
            <i class="fa fa-twitter" aria-hidden="true"></i>
          </button>


          <button type="button" name="button" class="btn btn-default" v-on:click="reloadPage()">
            <i class="fa fa-play" aria-hidden="true"></i>
          </button>
        </p>
      </div>
    </div>
              
            
!

CSS

              
                @import 'https://fonts.googleapis.com/css?family=Poiret+One';
@import 'https://fonts.googleapis.com/css?family=Roboto:300,400,500';

body {
    line-height: 1.5;
    padding: 4em 1em;
    color: #555;
    font-family: "Poiret One", "Roboto", sans-serif;
    background: url('http://images.unsplash.com/photo-1464655646192-3cb2ace7a67e?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=1080&fit=max&s=5a46937ae3f4f177da248eaf850a0a11');
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    display: flex;
    flex-wrap: wrap;
}


.container {
  min-width: 40em;
    margin: 0 auto;
    background: rgba(204, 204, 204, .5);
}


h1, h2 {
  text-align: center;
}
h1 {
    font-size: 3em;
    font-weight: lighter;
}
h2 {
  text-transform: capitalize;
}


a {
  &:focus {
      outline: thin dotted;
      outline: 5px auto -webkit-focus-ring-color;
      outline-offset: -2px;
  }
  &:hover, &:focus {
      color: #198764;
      text-decoration: underline;
  }
}
.module {
  border: 1px solid #ccc;
  margin: 0 auto;
  width: 40%;
  > h2 {
    padding: 1rem;
    margin: 0 0 0.5rem 0;
  }
  > p {
    padding: 0 1rem;
  }
}

.stripe {
  width: 50%;
  margin: 0 auto;
  height: 15px;
  color: white;
  background: linear-gradient(
  to bottom,
  #fff 10%,
  #fff 10%,
  transparent 0%,
  transparent 0%
  );
  background-size: 100% 5px;
}

.buttons {
    margin-bottom: 1em;
    border-bottom: 5px solid white;
    margin-left: 10px;
    margin-right: 10px;
    text-align: center;
}

.fa {
  display: inline-block;
  font: normal normal normal 14px/1 FontAwesome;
  font-size: inherit;
  text-rendering: auto;
  font-smoothing: antialiased;
}

.btn-default {
    text-shadow: 0 1px 0 #fff;
}
.btn {
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.2);
}
.btn-default {
    color: #333;
    background-color: #fff;
    border-color: #ccc;

    &:focus, &.focus {
        color: #333;
        background-color: #e6e6e6;
        border-color: #8c8c8c;
    }
}
.btn {
    display: inline-block;
    margin-bottom: 0;
    font-weight: normal;
    text-align: center;
    vertical-align: middle;
    touch-action: manipulation;
    cursor: pointer;
    background-image: none;
    border: 1px solid transparent;
    white-space: nowrap;
    padding: 6px 12px;
    font-size: 14px;
    line-height: 1.42857143;
    border-radius: 4px;
    user-select: none;

    &:hover, &:focus, &.focus {
        color: #333;
        text-decoration: none;
    }
    &:focus, &:active:focus, &.active:focus, &.focus, &:active.focus, &.active.focus {
        outline: thin dotted;
        outline: 5px auto -webkit-focus-ring-color;
        outline-offset: -2px;
    }
}


.fa-twitter, .fa-play {
  color: #74c3e2;
}

              
            
!

JS

              
                
    var tweetLink = 'https://twitter.com/intent/tweet?text=';
    
      new Vue({
        el: '#my_view',
        data: {
           origin: '',
          randQuotes: [
    {
      "quote": "You can avoid reality, but you cannot avoid the consequences of avoiding reality.",
      "author": "Ayn Rand",
      "category": "Famous"
    },
    {
      "quote": "I can write better than anybody who can write faster, and I can write faster than anybody who can write better.",
      "author": "A. J. Liebling",
      "category": "Famous"
    },
    {
      "quote": "This book fills a much-needed gap.",
      "author": "Moses Hadas in a review",
      "category": "Famous"
    },
    {
      "quote": "A mathematician is a device for turning coffee into theorems.",
      "author": "Paul Erdos",
      "category": "Famous"
    },
    {
      "quote": "The only difference between me and a madman is that I'm not mad.",
      "author": "Salvador Dali",
      "category": "Famous"
    },
    {
      "quote": "Never interrupt your enemy when he is making a mistake.",
      "author": "Napoleon Bonaparte",
      "category": "Famous"
    },
    {
      "quote": "If you are going through hell, keep going.",
      "author": "Sir Winston Churchill ",
      "category": "Famous"
    },
    {
      "quote": "He who has a 'why' to live, can bear with almost any 'how'.",
      "author": "Friedrich Nietzsche",
      "category": "Famous"
    },
    {
      "quote": "I'm all in favor of keeping dangerous weapons out of the hands of fools. Let's start with typewriters.",
      "author": "Frank Lloyd Wright",
      "category": "Famous"
    },
    {
      "quote": "I am ready to meet my Maker. Whether my Maker is prepared for the great ordeal of meeting me is another matter.",
      "author": "Sir Winston Churchill",
      "category": "Famous"
    }
  ]
        },

        ready: function() {

            this.getQuote()

          },
        methods: {
          reloadPage: function () {
            this.getQuote()
          },
          getQuote: function () {
            const idx = Math.floor(Math.random() * this.randQuotes.length);
            this.origin = this.randQuotes[idx]
          },
          tweetThis: function () {
            var myUrl = tweetLink + this.origin.quote + ' - ' + this.origin.author;
            window.open(myUrl, 'twitter');
            return false;
          }
        },

      });
              
            
!
999px

Console