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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <body>
  <div class="container-fluid">
    <!-- Navigation Bar -->
    <nav class="navbar navbar-default navbar-fixed-top">
      <div class="navbar-header">
        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>                        
				</button>
      </div>
      <div class="collapse navbar-collapse" id="myNavbar">
        <ul class="nav navbar-nav navbar-right">
          <li><a href="https://www.joelpeyton.co.uk/#about" target="_blank">about</a></li>
          <li><a href="https://www.joelpeyton.co.uk/#designs" target="_blank">designs</a></li>
          <li><a href="https://www.joelpeyton.co.uk/#progs" target="_blank">programming</a></li>
          <li><a href="https://www.joelpeyton.co.uk/#contact" target="_blank">contact</a></li>
        </ul>
      </div>
    </nav>

    <div class="row" id="topLine">
      <div class="col-sm-2 col-xs-2" style="width: 15%; height: 5px; background-color: rgb(192, 57, 43)"></div>
      <div class="col-sm-2 col-xs-2" style="width: 10%; height: 5px; background-color: rgb(230, 126, 34)"></div>
      <div class="col-sm-2 col-xs-2" style="width: 20%; height: 5px; background-color: rgb(241, 196, 15)"></div>
      <div class="col-sm-2 col-xs-2" style="width: 30%; height: 5px; background-color: rgb(46, 204, 113)"></div>
      <div class="col-sm-2 col-xs-2" style="width: 25%; height: 5px; background-color: rgb(52, 152, 219)"></div>
    </div>
    
    
    <!-- Body Section -->
    <div class="row">
      <div class="col-sm-12 col-xs-12 text-center" id="title">
        <h2>RANDOM QUOTE MACHINE</h2>
      </div>
    </div>

    <div class="row" id="panels" style="margin-bottom: 50px;">
      <div class="col-sm-3 col-xs-3"></div>
      <div class="col-sm-6 col-xs-6 text-center">
        <div class="panel panel-default">
          <div class="panel-body" id="theQuote">"A collection of quotes from the 2016 Grumpy Cat Calendar."
          </div>
        </div>
        <div><span><a href="https://twitter.com/intent/tweet?" id="tweet" title="Tweet My Quote" target="_blank" style="float: left"><i class="fa fa-twitter"></i></a></span><button type="button" class="btn btn-default" id="quoteBtn" style="float: right">New Quote</button></div>
      </div>
      <div class="col-sm-3 col-xs-3"></div>
    </div>


    <!-- Footer Section -->
    <div class=" row text-right" id="social">
      <span class="social"><a href="https://joelpeyton.co.uk/#contact" title="Contact me" target="_blank"><i class="fa fa-envelope-o"></i></a></span>
      <span class="social"><a href="https://codepen.io/joelpeyton/" title="Code Pen" target="_blank"><i class="fa fa-codepen"></i></a></span>
      <span class="social"><a href="https://github.com/joelpeyton" title="GitHub" target="_blank"><i class="fa fa-github"></i></a></span>
      <span class="social"><a href="https://linkedin.com" title="LinkedIn" target="_blank"><i class="fa fa-linkedin"></i></a></span>
      <span class="social"><a href="https://facebook.com" title="Facebook" target="_blank"><i class="fa fa-facebook"></i></a></span>
      <span class="social"><a href="https://twitter.com" title="Twitter" target="_blank"><i class="fa fa-twitter"></i></a></span>
    </div>

    <div class="row" id="bottomLine" style="margin-bottom: 20px;">
      <div class="col-sm-2 col-xs-2" style="width: 15%; height: 40px; background-color: rgb(192, 57, 43)"></div>
      <div class="col-sm-2 col-xs-2" style="width: 10%; height: 40px; background-color: rgb(230, 126, 34)"></div>
      <div class="col-sm-2 col-xs-2" style="width: 20%; height: 40px; background-color: rgb(241, 196, 15)"></div>
      <div class="col-sm-2 col-xs-2" style="width: 30%; height: 40px; background-color: rgb(46, 204, 113)"></div>
      <div class="col-sm-2 col-xs-2" style="width: 25%; height: 40px; background-color: rgb(52, 152, 219)"></div>
    </div>
    <div class="row text-center" style="margin-bottom: 20px;">
      <div class="col-sm-12 col-xs-12">
        <p>designed by <a href="https://www.joelpeyton.co.uk" title="Joel Peyton Web Design" target="_blank"><span class="joel">JP</span></a></p>
      </div>
    </div>
  </div>
</body>
              
            
!

CSS

              
                	/**** Global ****/
	
	body {
	  background-color: rgb(0, 0, 0);
	  font-family: 'Fredericka the Great', monospace;
	  font-size: 20px;
	  color: #fff;
	}
	
	a {
	  color: #fff;
	}
	
	a:link,
	a:visited,
	a:hover,
	a:active {
	  color: #fff;
	  text-decoration: none;
	}
	
	.grumpy {
	  font-style: italic;
	  float: right;
	}
	
	#topLine {
	  margin-top: 50px;
	}
	
	.joel {
	  font-size: 20px;
	  color: #fff;
	  border: 1px solid #fff;
	  padding: 5px;
	  letter-spacing: 0px;
	}
	
	.navbar {
	  margin-bottom: 0px;
	  margin-right: 10px;
	  background-color: #000;
	  z-index: 2;
	  border: none;
	  font-size: 20px !important;
	  line-height: 1.42857143 !important;
	  letter-spacing: 4px;
	}
	
	.navbar-default .navbar-nav>li>a {
		color: #fff;
	}

	.navbar-nav li a:hover, .navbar-nav li.active a {
		background-color: #fff !important;
	}

	.navbar-default .navbar-toggle {
		border-color: transparent;
		color: #fff !important;
	}
	
	.panel-default {
	  background-color: rgb(52, 152, 219);
	  border-color: rgb(52, 152, 219);
	  -webkit-transition-duration: 1.0s;
	  /* Safari */
	  transition-duration: 1.0s;
	}
	
	.panel-body {
	  min-height: 200px;
	}
	
	.panel-footer {
	  background-color: #000;
	  border-top: none !important;
	}
	
	.social {
	  font-size: 32px;
	  letter-spacing: 10px;
	}
	
	.btn-default {
	  background-color: #000;
	  color: #fff;
	}

	
	pre {
	  background-color: lightgrey;
	  border: 1px solid black;
	  padding-left: 20px;
	  padding-bottom: 20px;
	}
	
	#input {
	  color: #000;
	  font-family: monospace;
	}
	
	#inputBtn {
	  color: #000;
	}
	
	#output {
	  font-family: monospace;
	}

	/**** Media queries ****/
	
	@media screen and (max-width: 600px) {
	  body {
	    font-size: 12px !important;
	  }
	  h2 {
	    clear: left;
	    font-size: 16px !important;
	    padding-top: 10px !important;
	  }
	  h3 {
	    font-size: 12px !important;
	  }
	  .social,
	  .joel {
	    font-size: 16px;
	  }
	}
              
            
!

JS

              
                var quotes = ["<p>" + '"New Year ..... same frown."' + "</p>" + "<p class='grumpy'>" + " Grumpy cat." + "<br>" + " January 2016" + "</p>",
  "<p>" + '"Absence makes the heart grow fonder ..... of your absence."' + "</p>" + "<p class='grumpy'>" + "Grumpy cat." + "<br>" + " February 2016" + "</p>",
  "<p>" + '"Having a bad day ..... good."' + "</p>" + "<p class='grumpy'>" + " Grumpy cat." + "<br>" + " March 2016" + "</p>",
  "<p>" + '"One hundred percent chance ..... of frown."' + "</p>" + "<p class='grumpy'>" + " Grumpy cat." + "<br>" + " April 2016" + "</p>",
  "<p>" + '"Take time to stop and ..... stomp the flowers."' + "</p>" + "<p class='grumpy'>" + " Grumpy cat." + "<br>" + " May 2016" + "</p>",
  "<p>" + '"Frown and the whole world frowns with you."' + "<p class='grumpy'>" + " Grumpy cat." + "<br>" + " June 2016" + "</p>",
  "<p>" + '"Don\'t worry ...... be grumpy."' + "</p>" + "<p class='grumpy'>" + " Grumpy cat." + "<br>" + " July 2016" + "</p>",
  "<p>" + '"You snooze you lose ..... just how I like it."' + "<p class='grumpy'>" + " Grumpy cat." + "<br>" + " August 2016" + "</p>",
  "<p>" + '"Eeny meeny miny ..... NO."' + "</p>" + "<p class='grumpy'>" + " Grumpy cat." + "<br>" + " September 2016" + "</p>",
  "<p>" + '"Take the path less travelled ...... and get lost."' + "</p>" + "<p class='grumpy'>" + " Grumpy cat." + "<br>" + " October 2016" + "</p>",
  "<p>" + '"Thanks ..... for nothing."' + "</p>" + "<p class='grumpy'>" + " Grumpy cat." + "<br>" + " November 2016" + "</p>",
  "<p>" + '"Tis the season ..... to be grumpy."' + "</p>" + "<p class='grumpy'>" + " Grumpy cat." + "<br>" + " December 2016" + "</p>",
  "<p>" + '"If life deals you lemons ..... throw them at someone."' + "</p>" + "<p class='grumpy'>" + " Grumpy cat." + "<br>" + " A bonus quote" + "</p>"
];

function randColour() {
  var randColour = getRandInc(0, 4);
  if (randColour === 0) {
    return "rgb(192, 57, 43)";
  } else if (randColour === 1) {
    return "rgb(230, 126, 34)";
  } else if (randColour === 2) {
    return "rgb(241, 196, 15)";
  } else if (randColour === 3) {
    return "rgb(46, 204, 113)";
  } else {
    return "rgb(52, 152, 219)";
  }
}

function getRandInc(min, max) {
  return Math.floor(Math.random() * (max - min + 1)) + min;
}

$(document).ready(function() {

  $("#quoteBtn").on("click", function() {
    var randQuote = getRandInc(0, 12);
    var quote = quotes[randQuote];    
    $("#theQuote").html(quote);

    var colour = randColour();
    $(".panel-default").css({
      "background-color": colour,
      "border-color": colour
    });

    $("#tweet").attr('href', 'https://twitter.com/intent/tweet?text=' + $("#theQuote").text());

  });
});
              
            
!
999px

Console