cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

            
              <div class="container">
  <header role="banner">
    <h1>Brand Name</h1>
    <nav>
      <ul>
        <li><a href="#main">Home</a></li>
        <li><a href="/about">About</a></li>
        <li><a href="/products">Products</a></li> 
        <li><a href="/login">Login</a></li>
      </ul> 
    </nav> 
  </header>
  <main id="main">
    <h2>Content goes here</h2>
    
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Consectetur deserunt, suscipit velit itaque vitae necessitatibus, impedit pariatur eos. Pariatur beatae sed repellendus iusto doloribus quidem asperiores quia exercitationem sint dicta!</p>
    
  </main>
</div>
            
          
!
            
              /* Defuault styles:
width: narrow,
orientation: portrait, 
update: slow,
scan: interlace,
monochrome: 1,
pointer: coarse, 
hover: none
*/

/* Creates large touch areas for finguers (coarse) */
li a {
  min-height: 4em;
}

/* Positions the navbar at the bottom for easy thumb access on small devices with portrait orientation */ 
h1, nav{
  position: fixed;
  left: 0;
  right: 0; 
}

/* Moves the main area to accomodate fixed header and navbar */
main {
  padding: 1em;
  padding-bottom: 5em;
  padding-top: 5em;
}

/* Mobile first: Accomodates the brand name on the left and the navigation on the right and it wraps without the need of width media queries */
header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
}

/* Center aligns the brand name */
h1 {
  display: flex;
  min-height: 2.5em;
  align-items: center;
  flex: 1 0 auto;
  padding-left: 1em;
  padding-right: 1em;
}

/* Flex items to make them streach */
nav {
  bottom: 0;
  display: flex;
  flex: 1 0 auto;
}

ul, li, li a {
 display: flex;
 flex: 1;
}

li a {
  flex: 1;
  align-items: center;
  justify-content: center;
  padding-left: 1em;
  padding-right: 1em;
  border-left: 1px solid black;
}

li:first-child a {
  border: none;
}

/* Detaches the fixed header and navbar for landscape viewports, fine pointers like a mouse and large screens */
@media (orientation: landscape), (pointer: fine), (min-width: 45em) {
  main {
    padding-bottom: 1em;
    padding-top: 1em;
  }
  h1, nav {
    position: static;
  }
}

/* Makes hit areas smaller for fine pointers like a mouse to gain viewport realestate */
@media (pointer: fine) {
  li a {
    min-height: 2.5em;
  }
}


/* Creates a vertical navigation on large landscape viewports */
  @media (orientation: landscape) and (min-width: 45em) {
  .container {
    display: flex;
  }

  header {
    display: block;
    flex: 0 0 20%;
  }
    
  header h1{
    min-height: 6em;
  }
    
  ul, li {
    display: block;
  }

  li a, li:first-child a {
    justify-content: start;
    border-left: 0;
    border-bottom: 1px solid black;
  } 
}

/* Adds an animation on devices that are capable to render animations smoothly. Filters devices like Kindles, TVs, touch devices */
@media (update: fast), (scan: progressive), (hover: hover) {
  li a {
    transition: all 0.3s ease-in-out;
  }
}

/* Removes underlines on links for color screens */
@media (color) {
  li a { text-decoration: none; }
}

/* Increases borders to 2px on interlace screens like plasma TVs */
@media (scan: interlace) {
    li a, li:first-child a {
    border-width: 2px;
  }
}

/* General make up: colors, fonts, etc */
html, body, .container { box-size: border-box; height: 100vh; }
body { font-family: sans-serif; line-height: 1.5; }
header { background: #393f44; border-top: 4px solid #00a8e1; color: white; }
nav { background: #292e34; }
h1 { background: #030303; font-weight: bold; }
li a { color: #ccc; }
li a:hover { background: #393f44; color: white }
h2, p { margin-bottom: 1em; }
h2 {font-weight: 700; }
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console