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.

            
              <!--
  WELP. That's about what I'm looking at.
  Picture: https://d.pr/i/giPt/qCX2bzdj

  (Thanks for watching! Gotta run :))
  https://codepen.io/chriscoyier/full/mewZzy/

  Side by side layout will work on a large screen. Flexbox makes that super easy. The hero graphic fills the area thanks to `background-size: cover`; It's super enormous though, and probably could benefit from differnet sizes in media queries in the CSS.

  Flexbox was super helpful with helping me keep the <h1> tag as the very first thing in the source order, yet, positioning to the lower left. Autoprefixer helps a ton with flexbox.

  SCSS was helpful in letting me nest that media query.

  CSS counters was a neat little touch in the menu area. The numbers don't really mean anything. In the real magazine they are page numbers. Would be nice to somehow make sure the "/"s don't start a new line...

  The main content area is exactly below the "fold" thanks to 100% height of the main header (which we reset at the breakpoint). That area didn't need any responsive help since it just had a `max-width` (largely for line-length readability).

  
-->

<header class="site-header">

  <div class="header-content">
  
    <div class="title-area">
      
      <h1>Hamburgers</h1>
      
      <p>This is a sub-headline. Yadda yadda stuff about hamburgers. You know how subheadlines work.</p>
      
      <div class="byline">
        <span>By</span>
        Johnny Hamburgers
      </div>
      
    </div>
  
    <nav role='navigation' class="toc">
      <ul>
        <li><a href="#hamburger-juicy">Juicy Hamburgers</a></li>
        <li><a href="#hamburger-fourth">Fourth of July Hamburgers</a></li>
        <li><a href="#0">Squash 'n' Hamburgers</a></li>
        <li><a href="#0">Bacon Cheeseburgers</a></li>
        <li><a href="#hamburger-juicy">Juicy Hamburgers</a></li>
        <li><a href="#hamburger-fourth">Fourth of July Hamburgers</a></li>
        <li><a href="#0">Squash 'n' Hamburgers</a></li>
        <li><a href="#0">Bacon Cheeseburgers</a></li>
      </ul>
    </nav>  
    
  </div>
  
  <div class="hero-graphic"><!-- always, right? --></div>

</header>

<main class="main-content">

  <article id="hamburger-juicy">
  
    <h2>Juicy Hamburger</h2>
    
    <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
    
  </article>
  
  <article id="burger-fourth">
  
    <h2>Fourth of July Hamburger</h2>
    
    <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
    
  </article>
  
  <article id="hamburger-juicy">
  
    <h2>Juicy Hamburger</h2>
    
    <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
    
  </article>
  
  <article id="burger-fourth">
  
    <h2>Fourth of July Hamburger</h2>
    
    <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
    
  </article>

</main>
            
          
!
            
              // I picked out some matching fonts.
@import url(https://fonts.googleapis.com/css?family=Oswald|Nunito:400,700);


/* Layout */
body, html {
  height: 100%;
  background: #eee;
  overflow-x: hidden;
}

.main-content {
  max-width: 600px;
  padding: 1rem;
  margin: 5rem auto 2rem;
  > article {
    margin: 0 0 10rem 0;
  }
}


/* Header */
.site-header {
  display: flex;
  height: 100%;
  background: white;
  @media (max-width: 700px) {
    height: auto;
    display: block;
    .header-content,
    .hero-graphic {
      width: 100%;
    }
    .hero-graphic {
      height: 200px;
    }
    .title-area {
      order: 1;
    }
    .toc {
      order: 2;
      background: #eee;
      margin: 1rem -2rem 0;
      padding: 1rem 2rem;
    }
  }
}
.header-content {
  width: 50%;
}
.hero-graphic {
  width: 50%;
  // this should default to a small graphic (or nothing)
  background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/3/burgers.jpg);
  background-size: cover;
  @media (min-width: 900px) {
    // use a HUGE one!
  }
  @media (min-width: 600px) {
    // use a MEDIUM one!
    // you get it.
  }
}
.header-content {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2rem;
}
.title-area {
  order: 2;
  > p {
    color: red;
  }
}
.byline {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1rem;
  > span {
    color: #999;
  }
}

/* Nav */
.toc {
  > ul {
    list-style: none;
    padding: 0;
    line-height: 1.6;
    > li {
      display: inline-block;
      counter-increment: nav;
      > a {
        text-decoration: none;
        color: #333;
        text-transform: uppercase;
        font-size: 0.9rem;
        &::before {
          content: "/";
          margin: 0 0.5rem;
          color: red;
        }
        &::after {
          content: counter(nav);
          font-weight: bold;
          margin: 0 0.5rem;
        }
        &:hover,
        &:focus {
          color: red;
        }
      }
      &:first-child {
        a::before {
          display: none;
        }
      }
    }
  }
}


/* Type */
body {
  font-family: 'Nunito', sans-serif;
}
h1, h2 {
  font-family: 'Oswald', sans-serif;
  text-transform: uppercase;
  font-size: 3.2rem;
  border-bottom: 4px solid black;
  margin: 0 0 0.5rem;
}
h2 {
  font-size: 2rem;
  border-width: 3px;
  color: #555;
}
            
          
!
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