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

              
                <link
  rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<body>
<div id="quote-box" class="jumbotron text-center">
  
<section id="wastext"><h1><span id="text">"If you go flying back through time, and you see somebody else flying forward into the future, it's probably best to avoid eye contact."</span></h1></section>
  <br/>
<div id="style-author"><p1> ...<span id="author">Jack Handey</span></p1></div>
     <section id="socialMedia" class="buttons">
      <a
         href="twitter.com/intent/tweet"
        class="button"
        id="tweet-quote"
        title="Tweet this quote!"
      target="twitter.com/intent/tweet"
      >
        <i class="fa fa-twitter"></i>
      </a>
      <a
        href=""
        class="button"
        id="tumblr-quote"
        title="Post this quote on tumblr!"
        target="_blank"
      >
        <i class="fa fa-tumblr"></i>
      </a>
       </section>
     <section>
  <button id="new-quote" class="btn btn-primary" type="submit">New Quote</button>
     </section>
  </div>
  </body>
              
            
!

CSS

              
                * {
  margin: 0;
  padding: 0;
  list-style: none;
  vertical-align: baseline;
}
html, body { overflow-x: hidden; }
body {
  color: black;
  font-family: 'Caveat', cursive;
  font-weight: 900;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background: rgba(89, 127, 165, 0.5);
}
#quote-box {
  position: relative;
  display: table;
  height: 80vh;
  width: 80vw;
 border: 4px solid black;
  margin: auto;
  padding: 15px;
  background-image: url("https://images.pexels.com/photos/158028/bellingrath-gardens-alabama-landscape-scenic-158028.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500");
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center; 
}

#style-author {
  position: relative;
  top: 20px;
  text-align: center;
  background-color: rgba(242, 241, 237,.6);
  width: 25%;
  border-radius: 1rem;}
#wastext {
  position: relative;
  font-size: 1.2rem;
  padding: 10px;
  text-align: center;
  margin: auto;
  background-color: rgba(242, 241, 237,.5);
  width: 90%;
  border-radius: 1rem;}

.btn {
  padding: 10px;
  font-size: 2rem;
  border-radius: 1rem;
}
.buttons {
 padding:10px; 
 width: 45px;
 display: block;
  border-radius: 1rem;
    .button {
      margin: 5px;
      height: 40%;
      border: none;
      border-radius: 5px;
      color: #fff;
      background-color: #333;
      outline: none;
      font-size: 0.85em;
      padding: 8px 18px 6px 18px;
      opacity: 1;
      cursor: pointer;
      &:hover {
        opacity: 0.9;
      }
  }
}

#new-quote {
  position: absolute;
  bottom: 11px;
  right: 11px;
  opacity: .8;
  cursor: pointer;
}
#socialMedia {
  width: auto;
  display: flex;
  
  position: absolute;
  bottom: 11px;
  left: 11px;
  background-color: white;
  opacity: .8;
}
              
            
!

JS

              
                let wallPaper = ["#1681ab", 
"#d6329d",
"#fa987d",
"#bd9813",
"#e6b8b8",
"#c4ae0a",
"#d65032",
"#8ba321",
"#320338",
"#4f052f"];
let background=["url(https://png.pngtree.com/thumb_back/fw800/background/20191026/pngtree-palm-beach-sunset-image_320421.jpg)", "url(https://images.pexels.com/photos/234510/pexels-photo-234510.jpeg?auto=compress&cs=tinysrgb&h=600&w=650)", "url(https://images.pexels.com/photos/533937/pexels-photo-533937.jpeg?auto=compress&cs=tinysrgb&h=750&w=1260)", "url(https://images.pexels.com/photos/371589/pexels-photo-371589.jpeg?auto=compress&cs=tinysrgb&h=750&w=1260)", "url(https://images.pexels.com/photos/230629/pexels-photo-230629.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500)", "url(https://images.pexels.com/photos/870711/pexels-photo-870711.jpeg?auto=compress&cs=tinysrgb&h=750&w=1260)",
"url(https://images.pexels.com/photos/302804/pexels-photo-302804.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500)",
"url(https://images.pexels.com/photos/1210273/pexels-photo-1210273.jpeg?auto=compress&cs=tinysrgb&h=750&w=1260)",
"url(https://images.pexels.com/photos/531321/pexels-photo-531321.jpeg?auto=compress&cs=tinysrgb&h=750&w=1260)", "url(https://images.pexels.com/photos/275538/pexels-photo-275538.jpeg?auto=compress&cs=tinysrgb&h=750&w=1260)"];
 
let quoteText = ["It takes a big man to cry, but it takes a bigger man to laugh at that man.", "If I ever get real rich, I hope I'm not real mean to poor people, like I am now.", "If trees could scream, would we be so cavalier about cutting them down? We might, if they screamed all the time, for no good reason.", "Sometimes I think you have to march right in and demand your rights, even if you don\'t know what your rights are, or who the person is you\'re talking to. Then on the way out, slam the door.",  
"I can picture in my mind a world without war, a world without hate. And I can picture us attacking that world, because they\'d never expect it.",
"Before you criticize someone, you should walk a mile in their shoes. That way when you criticize them, you are a mile away from them and you have their shoes.", 
"To me, boxing is like a ballet, except there's no music, no choreography, and the dancers hit each other.", 
"Sometimes when I reflect back on all the beer I drink I feel ashamed. Then I look into the glass and think about the workers in the brewery and all of their hopes and dreams. If I didn\'t drink this beer, they might be out of work and their dreams would be shattered. Then I say to myself, It is better that I drink this beer and let their dreams come true than to be selfish and worry about my liver.",
 "Do you know what happens when you slice a golf ball in half? Someone gets mad at you. I found this out the hard way.", 
"I hope if dogs ever take over the world, and they chose a king, they don\'t just go by size, because I bet there are some Chihuahuas with some good ideas."];
//the compliance array has progressively divergent names. These are all Jack Handey quotes
let compliance = ["Jack Handey ", "Jack Handey", "Mr J.Handey", "Jack Handey JR", "Jack Handey", "Jack Handey", "Jack", "JP.Handey", "Gandhi", "Daryl"];
const newQuote = document.getElementById("new-quote");
const myText = document.getElementById("text");
const myBG = document.getElementById("quote-box");
const myAuthor = document.getElementById("author");
const myWall = document.querySelector("body");


const quoteChanger = function() {
  let index = Math.floor(Math.random() * 10);
  let Wall = wallPaper[index];
  let BG = background[index];
  let data = quoteText[index];
  let dataAuthor = compliance[index];
  
  myWall.style.background = Wall;
  myBG.style.backgroundImage = BG;
  myText.innerHTML = data;
  myAuthor.innerHTML = dataAuthor;
}
newQuote.addEventListener('click', quoteChanger);
console.log(quoteChanger);


//let backgrounds = ["walk","run","fly"];
//let urlA = "url(";
//let urlB = ")";
//let scenicPics = background.forEach(iterate(el,i) => let urlA + el[i] + urlB);
//console.log(scenicPics);

//function theCat(arr) {
 // let strArr = [];
//  let urlB = ")";
//  let urlA = "url(";
 
//  for (let i = 0; i < strArr.length; i++) {
//    return [urlA, arr[i], urlB].join("");
//  } 
//}
//let backgrounds = ["walk","run","fly"];
//console.log(theCat(backgrounds));



              
            
!
999px

Console