Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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 href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">

<div id="wrapper">
<header class="mobile-only" id="mobile-header">
  <button id="open-nav" class="mobile-only">
      <i class="fa fa-bars"></i>
  </button>
  <span class="site-title">Frederik Creemers</span>
</header>
<nav id="nav">
  <button class="fr mobile-only" id="close-nav">
    <i class="fa fa-times"></i>
  </button>
  <div class="site-title">
    Frederik Creemers
    <img class="round" src="https://www.gravatar.com/avatar/5e4575fdaacc879dc2199490417d170a?s=200">
  </div>
  <ul id="menu">
    <li>
      <a href="/">
        Home<i class="fa fa-home"></i>
      </a>
    </li>
    <li>
      <a href="/blog">
        Blog<i class="fa fa-rss"></i>
      </a>
    </li>
    <li>
      <a href="/about">
        About<i class="fa fa-user"></i>
      </a>
    </li>
    <li>
      <a href="https://github.com/bigblind">
        Github<i class="fa fa-github"></i>
      </a>
    </li>
    <li>
      <a href="https://twitter.com/_bigblind">
        Twitter<i class="fa fa-twitter"></i>
      </a>
    </li>
  </ul>
</nav>
<section id="main">
  <h1 class="page-title">
    Page title
  </h1>
  <section>
    <h1>A blog post about tech</h1>
    <span class="postdate"><i class="fa fa-calendar" aria-hidden></i> February 2nd, 2017</span>

<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. An vero, inquit, quisquam potest probare, quod perceptfum, quod. Haec quo modo conveniant, non sane intellego. Aliter enim explicari, quod quaeritur, non potest. Sed quid sentiat, non videtis. Duo Reges: constructio interrete. At, illa, ut vobis placet, partem quandam tuetur, reliquam deserit. Legimus tamen Diogenem, Antipatrum, Mnesarchum, Panaetium, multos alios in primisque familiarem nostrum Posidonium. Quae hic rei publicae vulnera inponebat, eadem ille sanabat. Semper enim ita adsumit aliquid, ut ea, quae prima dederit, non deserat. </p>

<p>Et quod est munus, quod opus sapientiae? Quantum Aristoxeni ingenium consumptum videmus in musicis? Sed plane dicit quod intellegit. Quod vestri non item. Dicet pro me ipsa virtus nec dubitabit isti vestro beato M. Quod idem cum vestri faciant, non satis magnam tribuunt inventoribus gratiam. </p>

<p>Ut in voluptate sit, qui epuletur, in dolore, qui torqueatur. An hoc usque quaque, aliter in vita? Tu autem negas fortem esse quemquam posse, qui dolorem malum putet. Ut pulsi recurrant? Piso igitur hoc modo, vir optimus tuique, ut scis, amantissimus. Ergo id est convenienter naturae vivere, a natura discedere. Portenta haec esse dicit, neque ea ratione ullo modo posse vivi; Roges enim Aristonem, bonane ei videantur haec: vacuitas doloris, divitiae, valitudo; </p>

<p>Non dolere, inquam, istud quam vim habeat postea videro; Mihi, inquam, qui te id ipsum rogavi? Et non ex maxima parte de tota iudicabis? Sed ne, dum huic obsequor, vobis molestus sim. Esse enim quam vellet iniquus iustus poterat inpune. </p>
<p><img src="https://thepracticaldev.s3.amazonaws.com/i/ket4231nz0m9ma8kogyf.gif" alt="The illustration shows 3 rectangles representing computer screens. One represents the option to move the screen image &quot;continuously with the pointer&quot;. In this mode, the screen moves as soon as the mouse moves. The position of the mouse on the magnified piece of the screen is proportional to the position of the mouse on the full-sized screen. In the &quot;keep pointer centered&quot; mode, the mouse stays centered as long as it is far away enough from the edge. When near the edge, the magnified image stops moving, so the pointer can move away from the center, towards the edge. In the &quot;only move on edges&quot; mode, the magnified portion of the screen doesn't move until the pointer hits one of the edges of the magnified area." /></p>
<p>Si autem id non concedatur, non continuo vita beata tollitur. Non est ista, inquam, Piso, magna dissensio. Bona autem corporis huic sunt, quod posterius posui, similiora. Negat esse eam, inquit, propter se expetendam. Ille vero, si insipiens-quo certe, quoniam tyrannus -, numquam beatus; Non quaeritur autem quid naturae tuae consentaneum sit, sed quid disciplinae. Mihi, inquam, qui te id ipsum rogavi? Potius inflammat, ut coercendi magis quam dedocendi esse videantur. </p>


  </section>
</section>
<section id="footer">
  &copy; 2017 Frederik Creemers
</section>
</div>
              
            
!

CSS

              
                html {
  background-color:red;
  margin:0;
  padding:0;
  font-size: 1rem;
  position:relative;
  width: 100%;
  height: 100%;
  min-height: 10rem;
}

*, *:before, *:after {
  box-sizing: border-box;
}

body {
  font-family: "Roboto Slab", "DroidSerif", Cambria, Georgia, "Times New Roman", Times, serif;
  font-style:normal;
  position:fixed;
  left:0;
  right:0;
  top:0;
  bottom:0;
  margin: 0;
  padding: 0;
  background-color: white;
}

#wrapper {
  display: flex;
  flex-direction:row;
  align-items: stretch;
  flex-wrap: wrap;
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  margin: 0;
  padding: 0;
  overflow: auto;
}

#mobile-header{
  width: 100%;
  background-color: #3c0000;
  color:white;
  vertical-align: middle;
  padding-left:1rem;
}

#mobile-header button, nav button{
  background-color: transparent;
  font-size: 2rem;
  color: yellow;
  border: none;
}

nav {
  color: white;
  flex: 1;
  background-color: #5c0120;
  position: relative;
  z-index:50;
}

nav button /* The button to close the nav on mobile. */{
  margin:1rem;
}

.site-title{
  font-size: 2rem;
  line-height: 5rem;
  text-align:center;
}

#site-title img{
  width: 70%;
  margin-top:1rem;
}

#main {
  flex: 5;
  padding: 7rem 5rem;
  position: relative;
  background-color: #DDD;
  z-index: 0;
}

#menu{
  list-style:none;
  padding:0;
  width: 20rem;
  position: relative;
  float: right;
  right: -3rem;
  line-height:6rem;
  margin-top:4rem;
  z-index:100;
}

#menu li{
  font-size: 3rem;
  border-radius: 3rem;
  text-align:right;
  display:block;
  height: 6rem;
  margin-bottom:1rem;
  color:white;
}

#menu li a {
  color: inherit;
  text-decoration: none;
  display:block;
}

#menu li:hover {
  background-color: white;
  color: #5c0120;
}

#menu i{
  line-height:5.6rem;
  width: 6rem;
  height: 6rem;
  float: right;
  border: 0.2rem solid #5c0120;
  border-radius:3rem;
  color: #5c0120;
  background-color:white;
  vertical-align: middle;
  text-align: center;
  margin-left: 0.5rem;
  font-size: 5rem;
  transition: transform 1s;
}

#menu li:hover i{
  animation: spin 5s linear infinite;
  transition: transform 1s;
}


.page-title {
  color: #5c0120;
  background-color:white;
  box-shadow: 0 0.2rem 0.2rem #AAAAAA;
  position: absolute;
  left:0;
  right:0;
  top:0;
  font-size: 2rem;
  margin: 0;
  padding-left: 6rem;
  line-height: 5rem;
  width: auto; 
}



#main section{
  background-color:white;
  padding: 2rem;
}

.postdate{
  color: grey;
}

#footer {
  width: 100%;
  background-color: #4b0009;
  color: white;
  text-align:center;
  padding: 0.5rem;
}

/* Utility classes */
.fw {
  width: 100%;
}

.round{
  border-radius: 50%;
}

.fr {
  float: right;
}

@keyframes spin {
  from{
    transform: rotate(0deg);
  }
  to{
    transform: rotate(360deg);
  }
}

@media (min-width:1001px){
  .mobile-only{
    display:none !important;
  }
}

@media (max-width:1000px){
  nav{
    position:fixed;
    top:0;
    left:0;
    bottom:0;
    transform:translate(-120%, 0);
    transition:transform 0.5s;
  }
  
  nav.open{
    transform: translate(0, 0);
    transition: transform 0.5s;
  }
  
  #main {
    padding: 6rem 1rem;
  }
  
  .page-title{
    padding-left: 1rem;
  }
  
  nav .site-title{
    display:none;
  }
}







              
            
!

JS

              
                var btn = document.getElementById("open-nav");
var btn2 = document.getElementById("close-nav");
var main = document.getElementById("main");
var nav = document.getElementById("nav");
var toggleNav = function(){
  nav.classList.toggle("open");
  console.log("toggle");
}
main.addEventListener("click", function(e){
  console.log(e.target)
  window.bbb = e.target;
  if(! (e.target.id === "open-nav" || e.target.parentElement.id === "open-nav")){
    nav.classList.remove("open");
  }
})

btn.addEventListener("click", toggleNav);
btn2.addEventListener("click", toggleNav);
              
            
!
999px

Console