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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

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

Visit your global Editor Settings.

HTML

              
                <div class="container">
            <h1>Points in #RWD</h1>
            <h2>Some of these examples allow you to click on the box to display results of computed values where noted.</h2>
  <p>A further suggestion is to scale your font-size globally from your browser preferences to see the usability issues from the font-size adjustment when points are present. All examples use a base <code>font-size</code> set on the <code>&lt;body&gt;</code> element at 100% or 16px or 1em.</p>
            <div class="box box1">
              <h1>Points work for <code>font-size</code></h1>
              <h2>click paragraph</h2>
              <code>font-size: 12pt = 16px</code>
                <p>Pellentesque habitant morbi tristique 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. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
            </div>
            <div class="box box2">
                <h1>Points work for fixed widths, but they will always be fixed</h1>
                <h2>click paragraph</h2>
                <code>width: 500pt</code>
                <p>Pellentesque habitant morbi tristique 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. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
            </div>
          <div class="box box3">
                <h1>Points work for padding -fixed of course</h1>
                <code>padding: 12pt</code>
                <p>Pellentesque habitant morbi tristique 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. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
            </div>
          <div class="box box4">
                <h1>Points Report Padding Incorrectly...sometimes</h1>
                <h2>click paragraph</h2>
                <code>font-size: 14pt; padding: 14pt/1em;</code>
                <code>Reported padding: 18.66666603088379px = should be 19px</code>
                <p>Pellentesque habitant morbi tristique 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. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
            </div>
  
  <div class="box box5">
                <h1>Points Suck at Relating</h1>
                <h2>click red box</h2>
                <code>p { font-size: 1.5em; } p span { padding: 14pt; }</code>
                <p>Pellentesque habitant morbi<span>This is a callout box</span>tristique 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. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
            </div>
  <div class="box box6">
                <h1>The em is relative</h1>
                <h2>click red box</h2>
                <code>p { font-size: 1.5em; } p span { padding: 1em; }</code>
                <p>Pellentesque habitant morbi<span>This is a callout box</span>tristique 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. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
            </div>
        </div>
              
            
!

CSS

              
                html {
  background: #eeeeee;
  font: normal 100%/1.5 Helvetica, sans-serif;
}

h1 {
  color: #f27427;
}

.container {
  width: 50%;
  margin: 0 auto;
}


/*global box*/
.box p {
    background: #e2e2e2;
}
.box p:hover {
    cursor: pointer;
}

/*box1 : font-size*/
.box1 p {
    font-size: 12pt;
}

/*box2 : width*/
.box2 {
  width: 500pt;
}

/*box3 : padding*/
.box3 p {
    padding: 12pt;
}

/*box4 : font-size pt and padding*/
.box4 p {
    font-size: 14pt;
    padding: 14pt;
}

/*box5 : font-size pt and padding*/
.box5 p {
    font-size: 1.5em;
}

.box5 p span {
    background: red;
    display: inline-block;
    padding: 14pt;
}

.box6 p {
    font-size: 1.5em;
}

.box6 p span {
    background: red;
    display: inline-block;
    padding: 1em;
}
              
            
!

JS

              
                $(document).ready(function(){
                  // Font Size
                  var currentFontSize = $('.box1 p').css('font-size');
                    $(".box1 p").click(function(){
                      alert(currentFontSize);
                  });

                  // Width
                  var currentWidth = $('.box2 p').css('width');
                    $(".box2 p").click(function(){
                      alert(currentWidth);
                  });

                  // Padding
                  var currentPadding = $('.box4 p').css('padding');
                    $('.box4 p').click(function(){
                      alert('the padding is' + ' ' + currentPadding);
                  });

                    // Padding
                  var currentSpan = $('.box5 p span').css('padding');
                    $('.box5 p span').on('click', function(){
                      alert(currentSpan);
                  });

                     // Padding
                  var currentSpan6 = $('.box6 p span').css('padding');
                    $('.box6 p span').on('click', function(){
                      alert(currentSpan6);
                  });
            });
              
            
!
999px

Console