cssAudio - ActiveCSS - 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.

            
              <article class="post">
  <header class="post-header">
    <h1>Header Level 1</h1>
    <p>This is some meta data</p>
  </header>
  <section class="post-content">

    <p><strong>Pellentesque habitant morbi tristique</strong> 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. <em>Aenean ultricies mi vitae est.</em>      Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, <code>commodo vitae</code>, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci,
      sagittis tempus lacus enim ac dui. <a href="#">Donec non enim</a> in turpis pulvinar facilisis. Ut felis.</p>

    <img src="http://fillmurray.com/1600/900" />


    <h2>Header Level 2</h2>

    <ol>
      <li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
      <li>Aliquam tincidunt mauris eu risus.</li>
    </ol>

    <blockquote>
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus magna. Cras in mi at felis aliquet congue. Ut a est eget ligula molestie gravida. Curabitur massa. Donec eleifend, libero at sagittis mollis, tellus est malesuada tellus, at luctus
        turpis elit sit amet quam. Vivamus pretium ornare est.</p>
    </blockquote>

    <div class="fluid-width-video-wrapper">
      <iframe width="560" height="315" src="https://www.youtube.com/embed/8GsXbuR23WU?ecver=1" frameborder="0" allowfullscreen></iframe>
    </div>

    <h3>Header Level 3</h3>

    <ul>
      <li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
      <li>Aliquam tincidunt mauris eu risus.</li>
    </ul>

    <pre><code>
#header h1 a {
  display: block;
  width: 300px;
  height: 80px;
}
</code></pre>

    <aside class="colored-bg-tier">
      <h2>What about tiers with colored backgrounds?</h2>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolores repellendus accusantium nostrum minima a ut perspiciatis ullam molestiae. Unde numquam, quisquam! Molestiae ipsa nesciunt reiciendis tempore voluptatum sequi sed sapiente?</p>
    </aside>

    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Magnam, dolores laboriosam nihil corrupti veniam eveniet quaerat cupiditate dolore quam voluptatum facere magni odit ipsum iste qui accusamus. Harum, rerum, incidunt?</p>

  </section>
</article>
            
          
!
            
              /* Reset Stuff */
body {
  padding: 0;
  margin: 0;
  line-height: 1.5;
}

img {
  display: block;
  max-width: 100%;
}

li {
  margin-left: 1.5em;
}

/* FitVids Stuff */
.fluid-width-video-wrapper {
  position: relative;
  height: 0;
  width: 100%;
  padding-top: 56.35%;
  iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }
}

/* CSS Trick Begins Here */
.post-header,
.post-content > *:not(img):not(.fluid-width-video-wrapper):not(.colored-bg-tier),
.colored-bg-tier > * {
  padding-left: 5%;
  padding-right: 5%;
  max-width: 50rem;  /*REM not EM */
  margin-left: auto;
  margin-right: auto;
}

.post-content > img,
.post-content > .fluid-width-video-wrapper {
  width: 1600px;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.colored-bg-tier {
  background: #f0f0f0;
  padding-top: 5%;
  padding-bottom: 5%;
}

/* Custom Post styles */
.post-content > blockquote {
  max-width: 47rem!important;
  /* This isn't good :( But I could move it to the exemption list if I want*/
  font-style: italic;
}

.post-header {
  border-bottom: 1px solid #ccc;
  h1 {
    margin-bottom: 0;
  }
  p {
    margin-top: 0;
  }
}
            
          
!
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