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.

            
              <header class="clearfix">
  <div class="logo"><h1>PTEC</h1></div>
  <nav role='navigation' class="main-nav">
    <ul>
      <li><a href="#">Project</a></li>
      <li><a href="#">Studio</a></li>
      <li><a href="#">Blog</a></li>
      <li><a href="#">Contact</a></li>
    </ul>
  </nav>  

</header>

<section>
  <h2>Some other stuff</h2>
</section>

            
          
!
            
              /* We apply the clearfix to the parent element.  In this case, it is the <header> */
.clearfix:after {
  content: "";
  display: table;
  clear: both;
}

/* When the screen is big enough (at least 30ems wide), we want to float the navigation menu left */
@media all and (min-width: 30em) {
  .main-nav {
    float: left;
  }
}

/* Removes some default padding */
.main-nav ul {
  padding-left: 0;
}

/* Removes default bullets */
.main-nav li {
  list-style-type: none;
}

/* Note that I add padding to the <a>, not the <li>.  This creates a larger target for people to click on, especially on small screens where precision is more difficult */
.main-nav li a {
  background-color: #303030;
  color: white;
  display: inline-block;
  padding: 1em;
  text-decoration: none;
  width: 100%;
}

.main-nav li a:hover {
  background-color: #222;
}

/* When the screen is big enough, make the <li>'s line up next to each other, and the width of the <a>'s as long as they need to be (by specifiying "auto") */
@media all and (min-width: 30em) {
  .main-nav li {
    display: inline-block;
  }
  .main-nav li a {
    width: auto;
  }
}

/* Increase padding on the <a>'s when the screen gets even bigger */
@media all and (min-width: 40em) {
  .main-nav li a {
     padding: 1em 1.5em;
  }
}

.logo {
  padding: 0 2em;
}

/* When the screen is big enough, align the logo with the navigation by floating it right */
@media all and (min-width: 30em) {
  .logo {
    float: right;
  }
}

            
          
!
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