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

+ add another resource


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


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.


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.


    <div class="wrapper" id="app">
        <section class="[ chunk ] [ flow-vertical ]">
            <h1 class="heading heading--primary"><abbr title="Pixel">PX</abbr> to REM calculator</h1>
            <p class="summary">Use this nifty tool to convert your pixel sizes to REM units.</p>

            <form action="get" class="[ form ] [ flow-vertical ]">
                <div class="form__group">
                    <label for="root_size" class="is-hidden--text">Add your root size</label>
                    <label for="root_size" aria-hidden="true" role="presentation" class="form__label">My root size is</label>
                    <input type="number" min="1" max="99" step="1" name="root_size" id="root_size" :value="rootSize" class="form__field" @input="calculate" @blur="tidyInputVal" />
                    <label for="root_size" aria-hidden="true" role="presentation" class="form__label">px.</label>
                <div class="form__group">
                    <label for="required_size" class="is-hidden--text">Add your required pixel size</label>
                    <label for="required_size" aria-hidden="true" role="presentation" class="form__label">I want my text to be</label>
                    <input type="number" min="1" max="99" step="1" name="required_size" id="required_size" :value="pxSize" class="form__field" @input="calculate" @blur="tidyInputVal" />
                    <label for="required_size" aria-hidden="true" role="presentation" class="form__label">px.</label>
        <section class="[ breathe--double-top ] [ result ]">
            Your REM size is: <b class="result__value">{{ remSize }}rem</b>
            <figure class="result__snippet">
                <figcaption class="is-hidden--text">CSS snippet with your new REM size</figcaption>
                        .your-element {
                            font-size: {{ remSize }}rem;
        <footer class="credit">
            <p>Made with ❤️&nbsp; by <a href="" rel="external">Hankchizljaw</a></p>



    This pen pulls in a default compilation
    of Stalfos' CSS

// Type
$base-font-family: 'Quicksand', sans-serif;

// Color
$charcoal: #333;
$magenta: #de6aec;

// Metric
$gutter: 20px;
$gutter--double: 40px;

html {
    font-size: 16px;

body {
    background: $magenta;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-family: $base-font-family;
    font-size: 1.250rem;
    line-height: 1.5;

abbr {
    text-decoration: none;
    border: none;
    outline: none;
    cursor: help;

a {
    color: $charcoal;
    &:focus {
        text-decoration: none;

.heading {
    font-weight: 400;
    &--primary {
        font-size: 2.250rem;
        line-height: 1.2;

.form {
    padding: $gutter 0 0 0;
    &__group {
        > * {
            display: inline;
    &__field {
        background: transparent;
        font-family: $base-font-family;
        padding: 2px 2px 0px 2px;
        border: none;
        font-size: 1.375rem;
        border: 1px solid transparent;
        border-bottom-color: $charcoal;
        position: relative;
        top: 1px;
        transition: all 200ms linear;
        &:focus {
            background: white;
            border-color: $charcoal;
            outline: none;
			border-radius: 3px;
    &__label {
        font-weight: 700;
        font-size: 1.375rem;

.result {
    border-top: 1px dashed $charcoal;
    padding: $gutter--double 0 0 0;
    font-size: 1.3rem;
    &__value {
        display: block;
        font-size: 2.188rem;
    &__snippet {
        pre {
            display: inline-block;
            padding: 16px $gutter $gutter $gutter;
            margin: $gutter 0 0 0;
            background: $charcoal;
            border-radius: 3px;
            white-space: normal;
        code {
            tab-size: 4;
            color: white;
            font-size: 1.2rem;
            line-height: 1;

.credit {
    padding: $gutter--double 0 $gutter 0;
    font-size: 1rem;
    font-weight: 700;
    color: $charcoal;


                const app = new Vue({
    el: '#app',
    data: {
        defaultRootSize: 16, // Used if the user leaves a field blank
        rootSize: 16,
        pxSize: 16,
        remSize: 1
    methods: {
        calculate(evt) {
            let self = this;
            // Attempt to parse the size from the evt input
            let parsedSize = ( ? parseInt(, 10) : self.defaultRootSize);
            // Find the target and set the appropriate data value
            switch('name')) {
                case 'root_size':
                    self.rootSize = parsedSize;
                case 'required_size':
                    self.pxSize = parsedSize;
            // Calculate rem sizw
            self.remSize = (self.pxSize / self.rootSize).toFixed(2);
            // Set it to 1 if something went wrong
            if(isNaN(self.remSize)) {
                self.remSize = 1;
        // Set the default root size if things get a bit larey
        tidyInputVal(evt) {
            if(! {
       = self.defaultRootSize;