cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

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.

            
              <h1>Box Model</h1>
<p>Every element on the page has its own box, which can be styled using CSS.</p>
<p>From the inside out:</p>
<ol>
  <li>content</li>
  <li>padding</li>
  <li>border</li>
  <li>margin</li>
</ol>

<h2>Background</h2>
<p>Keep in mind that a <code>background</code> will cover the content and the padding.</p>

<h2>Together</h2>
<ol>
  <li>Give the <code>h1</code> a red background, some padding, and a black border.</li>
  <li>Give every <code>p</code> a blue background, white text, some padding, and a black border.</li>
  <li>Give every <code>code</code> element a white background, black text, a little padding, and a thin border.</li>
</ol>

<h2>Now You Try</h2>
<ol>
  <li>Try adding styles for the <code>h2</code>s, <code>ol</code>s, and <code>li</code>s on this page.</li>
  <li>Look into the syntax for <code>margin</code> and try adding more space around elements by using them.</li>
</ol>
            
          
!
            
              body {
  font-family: sans-serif;
  line-height: 1.5;
}

h1 {
  background: red;
  padding: 15px;
  border: 5px solid black;
}

p {
  color: white;
  background: blue;
  padding: 15px;
  border: 5px solid black;
}

code {
  color: black;
  background: white;
  padding: 2px 5px;
  border: 1px solid black;
}
            
          
!
999px
Loading ..................

Console