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

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 id="container">
  <nav id="nav">
    <ul>
      <li class="currentpage"><a href="index.html">Home</a>
      </li>
      <li><a href="about.html">About</a>
      </li>
      <li><a href="portfolio.html">Portfolio</a>
      </li>
    </ul>

  </nav>
  <header>
    <h1>Header</h1>

  </header>

  <section>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus gravida malesuada pharetra. Vestibulum ultricies auctor tellus id tempus. Nam vel mauris nec velit malesuada sollicitudin eget sit amet lectus. Nunc ante felis, consectetur sit amet
      ornare a, rhoncus non sem. Donec dignissim ullamcorper commodo. Nulla facilisis velit tellus. Nullam at nunc a augue feugiat auctor. Aliquam erat volutpat.</p>
    <p>
      Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent ornare ante sit amet lacus rutrum condimentum. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nullam imperdiet orci vel leo sollicitudin vehicula
      blandit sem feugiat. Maecenas elementum, magna eu iaculis ornare, lacus tellus rhoncus tortor, sit amet pharetra metus nisl vitae quam. Integer convallis consequat ante in varius. Donec malesuada rutrum lectus id venenatis. Class aptent taciti sociosqu
      ad litora torquent per conubia nostra, per inceptos himenaeos. Maecenas ipsum nisi, aliquam a dictum vel, porttitor quis est. Vestibulum tincidunt malesuada urna, non gravida augue egestas volutpat. Nunc nec rutrum enim.</p>
    <p>
      Donec eu ligula libero. Vivamus sit amet urna sem, in viverra nisl. Vivamus condimentum tempor fringilla. Aliquam erat volutpat. Aliquam auctor, augue in scelerisque scelerisque, ante arcu vulputate nunc, sit amet accumsan libero ligula ut quam. Proin
      ac ante vel velit sollicitudin ultrices. Donec pretium mattis sem, a fermentum lorem pharetra sit amet. Praesent nisl felis, vulputate non imperdiet in, volutpat et nisl. Maecenas iaculis elementum lorem, et gravida sem semper vitae. In hac habitasse
      platea dictumst. Proin id tellus a dolor ullamcorper semper. Integer ornare laoreet tortor, et suscipit orci dictum non. In hac habitasse platea dictumst.</p>
  </section>

  <!-- #container -->
</div>
            
          
!
            
               * {
   /* clear out browser defaults */
   margin: 0;
   padding: 0;
   box-sizing: border-box;
 }
 /* set mobile design as the default */
 
 #container {
   max-width: 700px;
   width: 95%;
   margin: 3em auto;
   /* center the div in the browser */
   /* margin top moves the design below the sticky navigation */
   text-align: left;
   background: #FFFFFF;
   position: relative;
   /* need to set the positioning of the #container for use of fixed positioning on other elements in this div */
   overflow: auto;
   padding-bottom: 10em;
   /* you need enough padding for your navigation to sit without overlap */
 }

 header {
   overflow: auto;
   /* make sure the images in the header are contained within the header box */
   margin-bottom: 1em;
 }
 
 nav {
      max-width: 700px; /* matches the #container. Make sure the set the position on #container to relative. */
   width: 95%;
   margin: 0 auto;
   position: fixed; /* makes nav stick to top */
   top: 0;
   /* if you want to make the nav be full width use
   left: 0; and right: 0;
   */
 }
 
 nav ul {
   list-style: none;
   /* gets rid of the bullets */
 }

nav li {
  display: inline-block; /* moves to one line */
  width: 32%;
}
 
 nav a {
   display: block; /* makes link take up the full width of each list item */
   background-color: #ccc;
   padding: 5px;
   border-bottom: 1px solid black;
   text-align: center;
   text-decoration: none;
 }
 
 nav a:hover,
 nav a:focus {
   /* navigation rollover */
   background-color: white;
 }
 
 nav a:link,
 nav a:visited {
   color: black;
 }
 


 

            
          
!
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