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.

              <div class="mt6 helvetica measure h-75 bg-white mw5 mw7-ns center pa3 ph5-ns">

  <div class="bg-white measure">
    <blockquote class="flex flex-column justify-center h5 ml0 mt0 mr4 pl4 black-90 bl bw2 b--blue" id="blockquote">
      <span id="text" class="f2"></span>
      <div class="f3">
        - <span id="author"></span>
  <div class="buttons">
    <a class="f6 link dim br2 ph3 pv2 mb2 dib white twitter" id="twitter"><i class = "fa fa-twitter"></i>  Tweet This</a>
    <a class="f6 link dim br2 ph3 pv2 mb2 dib white" id="new-quote">New quote</a>

<div id="tweet-container"></div>

<form method="post" name="Form" action="" class="mt5">
  <label for="userName" class="mr4">If you want to make it personal, type your name: </label>
  <input cols="20" rows="1" name="userName" id="userName" placeholder="name"></input>

<footer class="mt3">
  <small class="ph3 ph4-ns pv6 white-70"> by 
    <a href="http://kevindav.us" class="static center link b f4 f4-ns dim white-70 lh-solid " target="_blank">Kevin Davis</a>
  background-color: #00aced;
  text-decoration: none;

      border: 5px solid white; 
      inset 0 0 8px  rgba(0,0,0,0.1),
            0 0 16px rgba(0,0,0,0.1); 
      inset 0 0 8px  rgba(0,0,0,0.1),
            0 0 16px rgba(0,0,0,0.1); 
      inset 0 0 8px  rgba(0,0,0,0.1),
            0 0 16px rgba(0,0,0,0.1); 
    padding: 1em;
    background: rgba(255,255,255,0.5);
    margin: 0 0 1em 0;

    width: 30%;
    min-width: 25em;
    border: 5px solid white;
    padding: 15px;
    background: rgba(255,255,255,0.5);
    margin: 0 auto;
    flex-wrap: nowrap;
    min-width: 40em;

  -webkit-touch-callout: none; /* iOS Safari */
  -webkit-user-select: none;   /* Chrome/Safari/Opera */
  -khtml-user-select: none;    /* Konqueror */
  -moz-user-select: none;      /* Firefox */
  -ms-user-select: none;       /* Internet Explorer/Edge */
  user-select: none;           /* Non-prefixed version, currently
                                  not supported by any browser */

              const quote = document.getElementById("new-quote");
const tweet = document.getElementById("twitter");
let hasName = false;
let httpRequest = new XMLHttpRequest();
let pUrl;
let rUrl = 'https://api.whatdoestrumpthink.com/api/v1/quotes/random';
let quoteText;
const quoteAuthor = 'Donald Trump';

document.onreadystatechange = function() {
  if (document.readyState === "interactive") {
window.onload = randBackground;
quote.onclick = nameCheck;
twitter.onclick = tweetIt;
function randBackground() {
  let color = '#' + Math.floor(Math.random() * 16777215).toString(16);
  quote.style.background = color;
  document.getElementById("blockquote").style["border-color"] = color;

function newQuote() {
  if (!hasName) {
  } else {
  function makeRequest(url) {
    httpRequest = new XMLHttpRequest();

    if (!httpRequest) {
      console.log('Giving up :( Cannot create an XMLHTTP instance');
      return false;
    httpRequest.onreadystatechange = alertContents;
    httpRequest.open('GET', url);

  function alertContents() {
    if (httpRequest.readyState === XMLHttpRequest.DONE) {
      if (httpRequest.status === 200) {
        quoteText = JSON.parse(httpRequest.responseText).message;
        document.getElementById("text").textContent = quoteText;
        document.getElementById("author").textContent = quoteAuthor;

       // console.log(JSON.parse(httpRequest.responseText).message);
      } else {
        console.log('There was a problem with the request.');

 function nameCheck()
    let nameValue =document.forms["Form"]["userName"].value;
      if (nameValue ==null||nameValue==""){
        hasName = false;
      else {
        hasName = true;
        pUrl = "https://api.whatdoestrumpthink.com/api/v1/quotes/personalized?q=" + nameValue;
function tweetIt(){
  let tweetText = quoteText + " - " + quoteAuthor;
  if (tweetText.length > 140) {
 alert('Tweet should be less than 140 Chars');
 else {
 var twtLink = 'https://twitter.com/intent/tweet?text=' +encodeURI(tweetText)+'&related=kevindavus,freecodecamp,codenewbies';
🕑 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 ..................