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

              
                <!DOCTYPE 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">
</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>
<!--
<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">
      <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>
      <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>-->
              
            
!

CSS

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

//Nav
.main-nav {
   max-width: 980px;
   margin: auto;
   padding: 10px 5px;
   background: #555;
   @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;
   }
}

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

.logo {
   @extend %highlight-section;
   padding: 0 10px;
   color: white;
   line-height: 2.5;   
   @include forSmallScreens(420) {
      font-size: .85em;
   }
}

//Search field
.search {
   @extend %highlight-section;
   padding: 5px;
   color: white;   
   @include forSmallScreens(420) {
      font-size: .85em;
   }
   .field {
      width: auto;
      margin: 0 10px 0 0;
   }
   button {
      @include forSmallScreens(420) {
         width: 100%;
         margin-top: 10px;
      }
   }
}

//Main Container
.main-container {
   max-width: 980px;
   margin: auto;
   padding: 10px;
   background: #999;
   border-radius: 0 0 3px 3px;
}

//Article
.article-container {
   @extend %highlight-section;
   margin-bottom: 20px;
   padding: 10px;   
}

   //Main Content of the Page
   .main-content {
      @extend %highlight-section;
      width: 75%;
      margin-right: 10px;
      padding: 10px;
      @include forSmallScreens(600) {
         width: 100%;
      }
      h1 {
         margin: 0;
      }
   }

   //Side Content
   .side-content {
      @extend %highlight-section;
      width: 25%;
      padding: 10px;
      font-size: .8em;
      background: #999;
      @include forSmallScreens(600) {
         width: 100%;
         margin-top: 12px;
      }
      h2 {
         margin: 0;
      }
      ol {
         padding-left: 20px;
      }
      a {
         color: #eee;
      }
   }

//Contact Form
.contact-form {
   @extend %highlight-section;
   width: 540px;
   margin: 0 auto 20px;
   padding: 20px;
   @include forSmallScreens(600) {
      width: 100%;
   }
   h2 {
      margin-top: 0;
   }
   label, button {
      display: block;
   }
   .comments {
      height: 100px;
   }
   .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%;
      }
   }
}

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

//Footer
.main-footer {
   color: white;
   padding: 10px;
   background: #333;
   p {
      margin-top: 0;
   }
}

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

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

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

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

blockquote {
   font-style: italic;
}
              
            
!

JS

              
                
              
            
!
999px

Console