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="container">
  <div id="viewed">

    <h1>Santigold's Lyrics</h1>
    <div id="inside">
      <div id="lyricText">
        <span id="lyricID"></span></div>
      <div id="songTitle"> <span id="songID"></span></div>
    </div>
    <button id="qButton" class="btn btn-default btn-lg" onload="lyric();" href="_target" onclick="lyricFunction();"><div id="btnID">New Extract</div></button>
    <a target="_blank" href="javascript:tweet()" class="btn btn-default btn-lg"><i id="buttonID"class="fa fa-twitter"></i></button></a>
  </div>
</div>
              
            
!

CSS

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

/*------------------------button params----------------*/

.fa-twitter {
  color: #55ACEE;
  width: 20px;
}

.btn-lg {
  background-color: #222222;
  margin-top: 20px;
  margin-bottom: 20px;
}

#btnID {
  color: yellow;
}

.btn-lg:hover {
  background-color: #222222;
}


/*----------------------container params-------------*/

#container {
  max-width: 600px;
  margin: 15% auto;
}

#viewed {
  border-radius: 5px;
  transition: 0.5s ease;
  box-shadow: -1px 2px 5px 1px black;
  text-align: center;
  font-family: 'Lobster', 'Helvetica';
}

h1 {
  padding-top: 10px;
  padding-bottom: 20px;
}


/*----------body params---------*/

body {
  background-color: #222222;
}
#songID {
  font-size:1.2em;
  text-decoration:underline;
}
#lyricID {
  font-size:1.4em;
}
              
            
!

JS

              
                function lyricFunction() {
  var lyric = ["“Change, change, change, change I want to get up out of my skin Tell you what, if I can shake it I'm-a make this, something worth dreaming of ”", "“And I like sometimes to wave it high Up where everyone can see I'm a lady”", "“J-j-jesus pieces Rescue me the more I try the more it gets too complicated”", "“You can make it alone if you try Till the beat come home, I know you'll sing it You can make it alone if you try They'll never see your fire till you make it out”", "“Freak like me, freak like me You a freak like me freak-freak like me-me”", "“While you're burnin' away The thing's goin' down You gotta move, you gotta move (yeah, ow)”", "“Big mouth, big mouth, quiet now, you said enough Got a big mouth, big mouth, my my my, you said enough”", "“Oh, we said our dreams will carry us And if they don’t fly we will run Now we push right past to find out Oh, how to win what they all lost.”"];
  var song = ["L.E.S artistes", "I m a Lady", "Anne", "God From The Machine", "Freak like Me", "Pirate in the water", "Big Mouth", "Disparate Youth"];
  var num = Math.floor(Math.random() * song.length);
  var lyric = lyric[num];
  var from = "From the song :" + " " + song[num];
  document.getElementById("lyricID").innerHTML = lyric;
  document.getElementById("songID").innerHTML = from;

  var changeColor = ["#FD5B78", "#FFFF66", "#CCFF00", "#FF6EFF", "#FF355E", "#AAF0D1", "#50BFE6", "#66FF66"];
  document.getElementById("viewed").style.backgroundColor = changeColor[num];

}

function tweet() {
  var tWord = document.getElementById("lyricID").innerText;
  var tName = document.getElementById("songID").innerText;
  var tLink = "https://twitter.com/share?text=" +
    encodeURIComponent(tWord) +
    " " + encodeURIComponent(tName) +
    '&url=' +
    'http';

  window.open(tLink);
}
window.onload = lyricFunction();
              
            
!
999px

Console