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

              
                <html>
<head>
   <meta charset="utf-8">
   <meta http-equiv="X-UA-Compatible" content="IE=edge">
   <meta name="viewport" content="width=device-width, initial-scale=1">
   <title>Mastering RWD with HTML5 &amp; CSS3</title>
   <link rel="stylesheet" href="css/site-styles.css">
   <!--Custom stuff-->
   <link href='https://fonts.googleapis.com/css?family=Slabo+27px' rel='stylesheet'>
</head>
<body>
<header class="masthead" role="banner">
   <div class="logo">Mastering RWD with HTML5 &amp; CSS3</div>
   <div class="search" role="search">
      <form>
         <label>Search:
            <input type="text" class="field">
            <button>Search Now!</button>
         </label>
      </form>
   </div>
</header>
   <nav class="main-nav" role="navigation">
      <ul class="nav-container">
         <li><a href="#">Link 1</a></li>
         <li><a href="#">Link 2</a></li>
         <li><a href="#">Link 3</a></li>
         <li><a href="#">Link 4</a></li>
      </ul>
   </nav>
   <main class="main-container" role="main">
      <h1>Chapter 2: Marking Our Content with HTML5</h1>
      <p>Many consider that HTML is “code”. Well, it’s not. HTML, any version of it, is a “markup” language. </p>
      <article class="article-container flex-container">
         <section class="main-content">
            <header>
               <h1>The <code>&lt;main></code> element  </h1>
            </header>
            <p>As per the MDN definition:</p>
            <blockquote>
               <p>The HTML Main Element (<code>&lt;main></code>) represents&hellip;</p>
            </blockquote>
         </section>
         <aside class="side-content" role="complementary">
            <h2>What Does “Semantic HTML” Mean?</h2>
            <p>Semantic markup basically means that we use HTML tags to describe what a specific piece of content is.</p>
         </aside>
      </article>
      <div class="contact-form" role="form">
         <header>
            <h2>Have Questions About HTML5?</h2>
         </header>
         <form>
            <div class="flex-container">
               <label class="label-col">Name: <input type="text" class="field name" id="name" required></label>
               <label class="label-col">Email: <input type="email" class="field email" id="email" required></label>
            </div>
            <label for="comments">Comments:</label>
            <textarea class="comments" id="comments" cols="50" required></textarea>
            <button>Send Question!</button>
         </form>
      </div>
<footer class="main-footer" role="contentinfo">
   <p>Copyright &copy;</p>
   <ul class="nav-container" role="navigation">
      <li><a href="#">Footer Link 1</a></li>
      <li><a href="#">Footer Link 2</a></li>
      <li><a href="#">Footer Link 3</a></li>
      <li><a href="#">Footer Link 4</a></li>
      <li><a href="#">Footer Link 5</a></li>
   </ul>
</footer>
   </main>
</body>
</html>
              
            
!

CSS

              
                ////Custom Declarations
   //Colors
   $bk: #272822;
   $r: #c03;
   $g: #429032;
   $b: #2963BD;
   $y: #c90;

//Media Query Mixin - Desktop-first
@mixin forSmallScreens($media) {
   @media (max-width: $media/16+em) { @content; }
}

//Header
.masthead {
   display: flex;
   justify-content: space-between;
   max-width: 980px;
   margin: auto;
   padding: 10px;
   background: $b;   
   @include forSmallScreens(700) {
      display: block;
      text-align: center;
   }
}

.logo {
   padding: 10px 0 10px 10px;
   color: white;
   line-height: 1.5;
   font-size: 1.3em;
   @include forSmallScreens(700) {
      padding: 10px 0;
      font-size: 1.5em;
   }
   @include forSmallScreens(420) {
      font-size: 1.1em;
   }
}

//Search field
.search {
   @extend %highlight-section;
   display: flex;
   align-items: center;
   justify-content: center;
   text-align: center;   
   color: white;
   font-size: .9em;
   @include forSmallScreens(700) {
      padding: 10px;
   }
   .field {
      width: 50%;
      margin: 0 5px;
      padding: 7px;
      @include forSmallScreens(420) {
         width: 70%;
      }
   }
   button {  
      @include forSmallScreens(420) {
         width: 90%;
         margin-top: 10px;         
      }
   }
}

//Nav
.main-nav {
   max-width: 980px;
   margin: auto;
   padding: 10px 5px;
   border-bottom: rgba(black,.2) 1px solid;
   background: lighten($y,20);
   @include forSmallScreens(420) {
      padding: 5px 0;
   }
}

//All Navigations
.nav-container {
   display: flex;
   justify-content: center;
   list-style-type: none;
   margin: 0;
   padding: 0;
   @include forSmallScreens(420) {
      flex-wrap: wrap;
   }
   li {
      display: flex;      
      width: 100%;
      margin: 0 5px;
      text-align: center;
      @include forSmallScreens(420) {
         display: flex;
         justify-content: center;
         flex-basis: 45%;
         margin: 5px;
      }
   }
   a {
      @extend %highlight-section;
      display: flex;
      justify-content: center;
      align-items: center;
      width: 100%;
      padding: 10px;
      color: white;
      text-decoration: none;
      font-size: 1.3em;
      box-shadow: inset 0 1px 2px rgba(black,.2);
      border-bottom: rgba(white,.6) 1px solid;      
   }
}

//Main Container
.main-container {
   max-width: 980px;
   margin: auto;
   padding: 40px 40px 20px;
   background: #2a2a2a;
   color: rgba(white,.8);
   border-bottom: $y 40px solid;
   @include forSmallScreens(420) {
      padding: 20px;
      line-height: 1.5;
   }
   //Main Headings
   &>h1 {
      margin-top: 0;
      padding-bottom: 10px;
      border-bottom: $y 3px solid;
      @include forSmallScreens(420) {
         font-size: 1.6em;
      }
   }
}

//Article
.article-container {
   margin-bottom: 20px;
   padding: 10px;
   background: rgba(white,.05);  
   border-radius: 2px;
   border: rgba(black,.2) 10px solid;
   box-shadow: 0 5px 15px rgba(black,.3);
}

   //Main Content of the Page
   .main-content {
      width: 75%;
      margin-right: 10px;
      padding: 10px;      
      @include forSmallScreens(600) {
         width: 100%;
      }
      h1 {
         margin: 0;
         padding-bottom: 10px;
         border-bottom: $g 3px solid;
      }
   }

   //Side Content
   .side-content {
      width: 25%;
      padding: 10px;
      font-size: .8em;
      border: $b 2px dotted;
      border-left: none;
      border-right: none;
      @include forSmallScreens(600) {
         width: 100%;
         margin-top: 12px;
      }
      h2 {
         margin: 0;
      }
      ol {
         padding-left: 20px;
      }
      a {
         color: #eee;
      }
      p {
         @include forSmallScreens(420) {
            font-size: 1.2em;
         }
      }
   }

//Contact Form
.contact-form {
   width: 540px;
   margin: 40px auto;
   padding: 20px;
   border: rgba(black,.2) 10px solid;
   box-shadow: 0 5px 15px rgba(black,.3);
   @include forSmallScreens(600) {
      width: 100%;
   }
   h2 {
      margin-top:0;
      padding-bottom: 10px;
      border-bottom: $r 3px solid;
   }
   label, button {
      display: block;      
   }
   input, textarea {
      margin-top: 5px;
   }
   .comments {
      height: 100px;
   }
   button {
      font-size: 1.3em;
      background: $b;
      @include forSmallScreens(420) {
         width: 100%;
      }
   }
   .flex-container {
      justify-content: space-between;
      @include forSmallScreens(600) {
         display: flex;
      }
      @include forSmallScreens(400) {
         display: block;
      }
   }
   .label-col {
      width: 48%;
      @include forSmallScreens(400) {
         width: 100%;
      }
   }
}

//Forms
.field,
.comments {
   width: 100%;
   margin-bottom: 10px;
   
   @include forSmallScreens(420) {
      width: 100%;
   }
}

//Form Elements
input, textarea {
   padding: 10px;
   border: none;
   background: rgba(white,.8);
   border-radius: 2px;
   box-shadow: inset 0 1px 1px rgba(black,.5);
}

button {
   border: none;
   padding: 7px 10px;
   background: #333;
   border-radius: 3px;
   color: white;
   font-family:"Slabo 27px", Arial, "Helvetica Neue", Helvetica, sans-serif;
   cursor: pointer;
}

//Footer
.main-footer {
   color: white;
   padding: 10px;
   border-top: $y 2px dotted;
   font-size: .7em;
   p {
      margin-top: 0;
      font-size: 1.2em;
   }
}

//Placeholder
%highlight-section {
   /*border: white 1px solid;
   border-radius: 3px;
   background: rgba(white, .1);*/
   background: rgba(black,.2);
   border-radius: 3px;
}

//Helper Classes
.flex-container {
   display: flex;
   @include forSmallScreens(600) {
      display: block;
   }
}

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

body {
   font-family: "Slabo 27px", Arial, "Helvetica Neue", Helvetica, sans-serif;
}

h1, h2 {
   color: white;
}

blockquote {
   font-style: italic;
   @include forSmallScreens(420) {
      margin-left: 10px;
   }
}
              
            
!

JS

              
                
              
            
!
999px

Console