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

              
                <script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>

<body>
	<div id="quote-box">
		<a href="#" id="new-quote">New</a>
		<a href="https://twitter.com/intent/tweet?status=" target="_blank" id="tweet-quote"><i class="fab fa-twitter"></i></a>
    <div class="quote">
      <i class="fas fa-quote-left"></i><div id="text"></div><i class="fas fa-quote-right"></i>
		<div id="author-container">-<div id="author"></div></div>
     </div>
	</div>
</body>
              
            
!

CSS

              
                body{
  background-color:#23395d;
  color:#ffd700;
}
a:link,a:visited{
  text-decoration:none;
}
a>i.fab{
 padding:14px;
}
i.fab,a#new-quote{
  padding:10px;
  font-size:50px;
  background: none;
  border: 2px solid #ffd700;
  color:#ffd700;
  float:right;
}
div#quote-box{
  border: 5px solid #ffd700;
  height:80vh;
  width:80vw;
  margin:auto;
  margin-top:100px;
}
i.fas{
  font-size:40px;
}
i.fa-quote-right{
  float:right;
}
div.quote{
  position:absolute;
  top:40vh;
  width:80vw;
}
div#text{
  margin:auto;
  text-align:center;
  font-size:30px;
}
div#author{
  display:inline
}
div#author-container{
  position:relative;
  top:30px;
  font-size:5vw;
  float:right;
}
              
            
!

JS

              
                //Data below
const QuotesArr=["I'm selfish, impatient and a little insecure. I make mistakes, I am out of control and at times hard to handle. But if you can't handle me at my worst, then you sure as hell don't deserve me at my best.","Be yourself; everyone else is already taken.","Two things are infinite: the universe and human stupidity; and I'm not sure about the universe.","So many books, so little time.","Be who you are and say what you feel, because those who mind don't matter, and those who matter don't mind.","A room without books is like a body without a soul.","You've gotta dance like there's nobody watching,\
Love like you'll never be hurt,\
Sing like there's nobody listening,\
And live like it's heaven on earth.","You know you're in love when you can't fall asleep because reality is finally better than your dreams.","You only live once, but if you do it right, once is enough.","Be the change that you wish to see in the world."];

const AuthorArr=["Marilyn Monroe","Oscar Wilde","Albert Einstein","Frank Zappa","Bernard M. Baruch","Marcus Tullius Cicero"," William W. Purkey","Dr. Seuss","Mae West","Mahatma Gandhi"];
///Data above


const TextElement=document.getElementById("text")
const AuthorElement=document.getElementById("author")
const buttonElement=document.getElementById("new-quote");
const TwitterHref=document.getElementById("tweet-quote").getAttribute("href");
let FinalHref;
const TwitterElement=document.getElementById("tweet-quote");

//Just for initializing the quote machine
const RandomNumber= Math.floor(Math.random()*10)
TextElement.textContent=QuotesArr[RandomNumber];
AuthorElement.textContent=AuthorArr[RandomNumber];

buttonElement.addEventListener('click',newQuote,false)
function newQuote(){
const RandomNumber= Math.floor(Math.random()*10)
TextElement.textContent=QuotesArr[RandomNumber];
AuthorElement.textContent=AuthorArr[RandomNumber];
}

FinalHref=TwitterHref+QuotesArr[RandomNumber]+" -"+AuthorArr[RandomNumber];
TwitterElement.setAttribute("href",FinalHref)
              
            
!
999px

Console