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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                
<html>


  <body >

    <div class="container-fluid">
      <div class="text-container">

        <p id="demo">Hello. I am your wallpaper :)</p>
      </div>
    <div class="btn-holder">
      
      <div><a id="tweet" href="https://twitter.com/intent/tweet" class="fa fa-twitter" aria-hidden="true" target="_blank">Tweet</a></div><br>
      <div ><button id="nextButton" class="button">next quote</button></div>    

    </div>
      
    </div>

  </body>
</html>

              
            
!

CSS

              
                body {
    background-image: url("https://res.cloudinary.com/nazarisaak/image/upload/c_scale,w_1625/v1493401674/sun-tree_brarhi.jpg");
  background-repeat: no-repeat;
}
.btn-holder {
  margin-left: 20%;
  margin-top: -10%;
}
#tweet {
  background-color: #0084b4;
  border: none;
  color: white;
  width: 100px;
  height: 2em;
  border-radius: 5px;
  margin-left: 20%;
  margin-top: 10%;
  display: inline-block;
}
#tweet:hover{
  background-color: #1990bb;
}
.fa-twitter {
  padding: 10px;
  font-size: 20px;
  width: 50px;
  text-align: center;
  text-decoration: none;
}
a:link {
    text-decoration: none;
}
#nextButton{
  width: 100px;
  height: 50px;
  background-color: #008CBA;
  opacity: .7;
  font-size: 16px;
  border: none;
  color: white;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  cursor: pointer;
  margin-left: 20%;
}

#nextButton:hover {
  background-color: #4CAECE;
}
#nextButton:active {
    background-color: black;
}
#demo {
  font-size: 30px;
  color: white;
  background: black;
}

.text-container {
  text-align: center;
  opacity: 0.5;
  width: 400px;
  height: 200px;
  margin-left: 20%;
  margin-top: 20%;
}

              
            
!

JS

              
                var quotes = [
  "Why so serious???",
  "I'm going to make him an offer he can't refuse.",
  "If you are cooler than me, would that make me hotter than you?",
  "If you cannot do great things, do small things in a great way :)",
  "A jug fills drop by drop",
  "You can discover more about a person in an hour of play, than in a year of conversation. Plato",
  "Knowledge is a treasure, but practice is the key to it",
  "Some days its hard to find motivation. Some days motivation finds You!!",
  "I want to be your favourite Hello, and you hardest Goodbye.",
  "One day, I caught myself smiling for no reason, then I realized that I was thinking of you",
  "Don't give up on your dreams... Keep sleeping.",
  "This is Spartaaa!!!"
];
var backImg = [
  'https://res.cloudinary.com/nazarisaak/image/upload/v1493402185/joker_czzmtn.jpg',
  'https://res.cloudinary.com/nazarisaak/image/upload/v1493402240/godfather_xymcbs.jpg',
  'https://res.cloudinary.com/nazarisaak/image/upload/c_scale,w_1631/v1493402266/zach_xluvml.jpg',
  'https://res.cloudinary.com/nazarisaak/image/upload/v1493402274/ants_sgd2zh.jpg',
  'https://res.cloudinary.com/nazarisaak/image/upload/v1493402286/buddha_cnodfs.jpg',
  'https://res.cloudinary.com/nazarisaak/image/upload/c_scale,w_1728/v1493402295/conversation_goorol.jpg',
  'https://res.cloudinary.com/nazarisaak/image/upload/v1493402305/library_t56b6y.jpg',
  'https://res.cloudinary.com/nazarisaak/image/upload/c_scale,w_1783/v1493396353/bear_xmpqie.jpg',
  'https://res.cloudinary.com/nazarisaak/image/upload/c_scale,w_1593/v1493402320/kiss_dxioaz.jpg',
  'https://res.cloudinary.com/nazarisaak/image/upload/v1493402325/heart_dludpq.jpg',
  'https://res.cloudinary.com/nazarisaak/image/upload/v1493402337/doggy_g84i73.jpg',
  'https://res.cloudinary.com/nazarisaak/image/upload/c_scale,w_1652/v1493402347/goat_pklmry.jpg'
];

document.getElementById('nextButton').onclick = displayNextQuote;
var text = document.getElementById('demo').innerHTML;

var index = 0;
var tweetUrl = "https://twitter.com/intent/tweet?text=";
document.getElementById('tweet').href = tweetUrl + text;

function showBackImage() {
  if( index == backImg.length) index = 0;
  document.body.style.backgroundImage = "url(" + backImg[index] + ")";
  document.body.style.transition = "background 1s ease-in-out 0s"
}

function displayNextQuote() {

  if( index == quotes.length) index = 0;
    document.getElementById('demo').innerHTML = quotes[index];
    document.getElementById('tweet').href = tweetUrl + quotes[index];
    showBackImage();
    index++;
}

              
            
!
999px

Console