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.

            
              <p><a href="http://www.w3.org/TR/CSS2/syndata.html#value-def-identifier">The CSS Spec</a> says you can't start a class name with a number. HOWEVER you can start it with a backslash-escaped identifier. So ".2 {}" is invalid, but ".\32 {}" - the character sequence for '2' is valid. Thanks to some solid coincidences the codepoints for numbers begin at \30, so \30 is 0, \31 is 1, \32 is 2 etc. So if you want to start your class name with a number prefix it with \3 and you're golden.</p>

<p>In addition to that, you can also have all kinds of other characters <a href="https://mathiasbynens.be/notes/css-escapes">as long as you escape them</a>. In this instance we're using / to show numeric fractions and <a href="https://csswizardry.com/2015/08/bemit-taking-the-bem-naming-convention-a-step-further/#responsive-suffixes">@ to denote changes at a given breakpoint</a>.</p>

<p>The following is totally valid HTML and CSS:</p>

<hr>

<div class="grid">
  <div class="grid__item 1/1 1/3@large"><p><code>1/1 1/3@large</code><br>Full width as a baseline, one third at large sizes</p></div>
  <div class="grid__item 1/2 1/3@large"><p><code>1/2 1/3@large</code><br>One half width as a baseline, one third at large sizes</p></div>
  <div class="grid__item 1/2 1/3@large"><p><code>1/2 1/3@large</code><br>One half width as a baseline, one third at large sizes</p></div>
</div>
            
          
!
            
              /* Base Widths */
.\31\/1 { width: 100%; }

.\31\/2 { width: 50%; }

.\31\/3 { width: 33.33333%; }
.\32\/3 { width: 66.66666%; }

/* Use the @ suffix to identify particular breakpoints */
@media (min-width: 600px) {
  .\31\/1\@large { width: 100%; }

  .\31\/2\@large { width: 50%; }

  .\31\/3\@large { width: 33.33333%; }
  .\32\/3\@large { width: 33.33333%; }
}



/* The simplest of grids systems */
.grid {
  margin-left: -8px;
  margin-right: 0;
  padding-left: 0;
  padding-right: 0;
  list-style: none;
  letter-spacing: -0.31em;
}

.opera:-o-prefocus,
.grid {
  word-spacing: -0.43em;
}


.grid__item {
  display: inline-block;
  box-sizing: border-box;
  padding-left: 8px;
  vertical-align: top;
  letter-spacing:normal;
  word-spacing:normal;
}

/* A splash of color */
.grid__item:nth-child(1) { color: red; }
.grid__item:nth-child(2) { color: green; }
.grid__item:nth-child(3) { color: blue; }
            
          
!
            
              console.log(document.querySelectorAll('.\\31\\/1'));
            
          
!
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