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.

+ add another resource

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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.

+ add another resource

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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 assuming you want a single number as the initial value.</p>

<p>In case you need to start a class name with multiple numbers characters - such as if you want a numerator of "15" - then CSS needs to be able to tell the difference between "that character is an literal character" and "that character is part of an escape sequence". There are a few ways to do this. The following examples all represent the classname "15/24": you can escape every number (e.g. ".\31\35\/24"), you can add a space after the end of an escape sequence (e.g. ".\31 5\/24"), or you can have exactly six hex characters in the escape code (e.g. ".\0000315\/24"). Using all escape sequences feels cleanest to me when we're talking about just numbers.</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>

<div class="grid">
  <div class="grid__item 11/24"><p><code>11/24 </code><br>Slightly under half width as a baseline</p></div>
  <div class="grid__item 13/24"><p><code>11/24</code><br>Slightly over half width as a baseline, is bold and italic to demonstrate other ways of targeting numerators greater than or equal to 10</p></div>
</div>
            
          
!
            
              /* Base Widths */
.\31\/1 { width: 100%; }

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

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

/* Numbers bigger than 10 can be represented by escaping every non-hex character */
.\31\31\/24 { width: 45.83333% } /* 11/24 */
.\31\33\/24 { width: 54.16667% } /* 13/24 */

/* There are other ways to make it explicit when an escape sequence ends, both of these target "13/24" */
.\31 3\/24 { font-weight: bold; } /* a space deliniates the end of an escape sequence */
.\0000313\/24 { font-style: italic; } /* using 6 hex chars for the escape sequence */


/* 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
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console