Pen Settings

HTML

CSS

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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

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.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

              
                .Font

   p “The line-height controls the leading, which is the extra space between lines of text above and beyond the font’s size”
   
   p.Formula
      span.Formula__result Computed line-height 
      span = 
      span.Formula__first Computed font-size (content area)
      span +
      span.Formula__second Leading Area
      
   .Setting
      section.Setting__prop font-size
         select(id = 'font-size-1')
            option(value="32px") 32px
            option(value="3rem") 3rem
            option(value="4rem") 4rem
            option(value="12px") 12px
            option(value="1.2em") 1.2em
            option(value="150%") 150%
      section.Setting__prop line-height
         select(id = 'line-height-1')
            option(value="48px") 48px
            option(value="1") 1
            option(value="1.4") 1.4
            option(value="normal") normal
            option(value="10px") 10px
            option(value="25vh") 25vh
   
   .Font__example
      p#elem.Font__line Content Area
         span &nbsp;

   

   
              
            
!

CSS

              
                

:root {
   --highlight : #F89406;
   --highlight-w: #BE90D4;
   --highlight-m: #19B5FE;
   --highlight-str: #DB0A5B;
   --line-height: 48px;
   --font-size: 32px;
}

body {
   box-sizing: border-box;
   background-color: #F5D76E;
   font-family: 'Josefin Slab', serif;
}

.Formula {
   line-height: 1.4;
   
   &__result {
     border: 3px solid var(--highlight-m);
   }
   
   &__first {
     background-color: var(--highlight)
   }
   
   &__second {
      background: var(--highlight-str); 
   }
}

.Setting {
   margin-bottom: 4rem;
   
   &__prop {
      font-size: 1rem;
   }
}

.Font {
   font-size: var(--font-size);
   margin: 3rem;
   
   &__serif {
      font-family: 'Josefin Slab', serif;
      background-color: var(--highlight);
      display: none;
   }
     
   &__line {
      background-color: var(--highlight);
      font-weight: 100;
      line-height: 1;
      position: relative;
      font-size: var(--font-size);
      margin: 0;
      padding: 0;
      
      & span {
         content: '\2002';
         display: inline;
         background: var(--highlight-str);
         border: 3px solid var(--highlight-m);
         line-height: var(--line-height);
         position: absolute;
         top: 50%;
         left: 50%;
         width: 100%;
         transform: translate(-50%, -50%);
         z-index: -1; 
         text-align: right;
      } 
   }
   
   &__sansSerif {
      background-color: var(--highlight-w);
      font-family: 'Oswald', sans-serif;
      font-weight: 100;
      display: none;
   }
   
   &__monospace {
      background-color: var(--highlight-m);
      font-family: 'Source Code Pro', monospace;
      display: none;
   }
}
              
            
!

JS

              
                let currFontsize = document.querySelector('#elem');

let currLineheight = document.querySelector('#elem span');

let fontsizeElem = document.getElementById('font-size-1');
let lineheightElem = document.getElementById('line-height-1');


let fontsize = fontsizeElem.value;
let lineheight = lineheightElem.value;

fontsizeElem.addEventListener('change', () => {
   currFontsize.style.setProperty("--font-size", fontsizeElem.value);
});

lineheightElem.addEventListener('change', () => {   
   currLineheight.style.setProperty("--line-height",  lineheightElem.value);
});
// set from ui the fontsize and line height to see the differences



//console.log(fontsize.value);
// get variable from inline style



getComputedStyle(currFontsize).getPropertyValue("--line-height");

//element.style.getPropertyValue("--line-height");

// get variable from wherever
//getComputedStyle(element).getPropertyValue("--my-var");


              
            
!
999px

Console