css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              
h1.fadeIn.animated FCC Random Quote Generator

p.fadeIn.animated Click the button below to generate a new random quote.

div#btn.fadeIn.animated
  i.fa.fa-quote-left
  span  Generate Quote 
  i.fa.fa-quote-right
hr
p#quote.fadeIn.animated
hr
a.fa.fa-twitter.fa-3x#tweet.fadeIn.animated



            
          
!
            
              $red: #ff5252
$white: #f2f2f2
$twitter: rgb(64,153,255)
$black: lighten(black, 13%)

body
  font-family: 'Open Sans'
  height: 100vh
  background-size: cover
  background-position: center center
  background-repeat: no-repeat
  padding: 2.5em  
  text-align: center
  padding: 2em 0em
  border-radius: 1.5em
  box-sizing: border-box

  h1
    font:
      size: 2.5em 
      weight: 700
    margin: 0em 0em
    border-bottom: 2px solid black
    display: inline
    color: $black
    
  hr
    border: 0
    height: 1px
    width: 50%
    background: #333
    background-image: linear-gradient(to right, #ccc, #333, #ccc)

  p
    font-size: 1em
    width: 90%
    margin: 1em auto
    color: lighten(black, 46%)

    @media (max-width: 600px)
      width: 90%
  #btn
    font:
      size: 1.5em
      weight: 700
    border: 2px solid $red
    color: $red
    display: inline-block
    padding: 0.5em 1.5em
    transition: all ease-in-out .3s
    border-radius: 2.5em
    user-select: none
    margin: 1em 0

    &:hover
      cursor: pointer
      color: $white
      background-color: $red
      border: 2px solid $red


  #quote
    width: 70%
    margin: 0 auto
    padding: 1em 2em
    font-size: 2em
    border-radius: 1.5em
    color: $black

    #author
      display: block
      font-size: 0.9em
      margin: 0.5em 0

      &:before,
      &:after
        content: ' -- '

  #tweet
    color: $black
    transition: color ease-in-out 0.3s
    text-decoration: none
    outline: 0

    &:hover
      cursor: pointer
      color: $twitter




            
          
!
            
              $(document).ready ->

  quote = ->
    url = 'https://andruxnet-random-famous-quotes.p.mashape.com/cat=famous'
    API_KEY = 'NvBtBmdtSImshF8Ul6PZVcHM8rPtp1HIevIjsnu6b1nua1d11M'
    $.ajax
      url: url
      type: 'PUT'
      dataType: 'json'
      beforeSend: (xhr) ->
        xhr.setRequestHeader 'X-Mashape-Authorization', API_KEY
        return
      success: (data) ->
        document.getElementById('quote').innerHTML = data.quote + '<em id="author"> ' + data.author + '</em>'
        twitterLink = document.getElementById('tweet')
        twitterLink.href = 'https://twitter.com/intent/tweet?text=' + '"' + data.quote + '"' + ' --' + data.author
        twitterLink.target = '_blank'
        return
    return

  quote() 
  
  document.getElementById('btn').onclick = ->
    quote()
    return

  return

# ---
# generated by js2coffee 2.1.0
            
          
!
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