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>CSS Dog customizer</h1>
    <div class="dog-editor">
        <input type="radio" id="eye-size5" name="eye-size">
        <label for="eye-size5" class="range-segment eye-size end"></label>
        <input type="radio" id="eye-size4" name="eye-size">
        <label for="eye-size4" class="range-segment eye-size"></label>
        <input type="radio" id="eye-size3" name="eye-size">
        <label for="eye-size3" class="range-segment eye-size"></label>
        <input type="radio" id="eye-size2" name="eye-size" checked>
        <label for="eye-size2" class="range-segment eye-size"></label>
        <input type="radio" id="eye-size1" name="eye-size">
        <label for="eye-size1" class="range-segment eye-size start"></label>
        <div class="label eye-size">Eye size</div>

        <input type="radio" id="nose-size5" name="nose-size">
        <label for="nose-size5" class="range-segment nose-size end"></label>
        <input type="radio" id="nose-size4" name="nose-size" checked>
        <label for="nose-size4" class="range-segment nose-size"></label>
        <input type="radio" id="nose-size3" name="nose-size">
        <label for="nose-size3" class="range-segment nose-size"></label>
        <input type="radio" id="nose-size2" name="nose-size">
        <label for="nose-size2" class="range-segment nose-size"></label>
        <input type="radio" id="nose-size1" name="nose-size">
        <label for="nose-size1" class="range-segment nose-size start"></label>
        <div class="label nose-size">Nose size</div>

        <input type="radio" id="dog-size5" name="dog-size">
        <label for="dog-size5" class="range-segment dog-size end"></label>
        <input type="radio" id="dog-size4" name="dog-size">
        <label for="dog-size4" class="range-segment dog-size"></label>
        <input type="radio" id="dog-size3" name="dog-size" checked>
        <label for="dog-size3" class="range-segment dog-size"></label>
        <input type="radio" id="dog-size2" name="dog-size">
        <label for="dog-size2" class="range-segment dog-size"></label>
        <input type="radio" id="dog-size1" name="dog-size">
        <label for="dog-size1" class="range-segment dog-size start"></label>
        <div class="label dog-size">Dog size</div>

        <input type="radio" id="collar-color4" name="collar-color">
        <label for="collar-color4" class="collar-color end"></label>
        <input type="radio" id="collar-color3" name="collar-color" checked>
        <label for="collar-color3" class="collar-color"></label>
        <input type="radio" id="collar-color2" name="collar-color">
        <label for="collar-color2" class="collar-color"></label>
        <input type="radio" id="collar-color1" name="collar-color">
        <label for="collar-color1" class="collar-color start"></label>
        <div class="label collar-color">Collar</div>

        <input type="radio" id="background-color4" name="background-color">
        <label for="background-color4" class="background-color end"></label>
        <input type="radio" id="background-color3" name="background-color">
        <label for="background-color3" class="background-color"></label>
        <input type="radio" id="background-color2" name="background-color">
        <label for="background-color2" class="background-color"></label>
        <input type="radio" id="background-color1" name="background-color" checked>
        <label for="background-color1" class="background-color start"></label>
        <div class="label background-color">Background</div>

        <div class="dog">
            <!-- CSS for the dog originally created by Lynn Fisher, https://a.singlediv.com/ -->
        </div>
    </div>
</div>
<div class="credits">
    CSS for the dog originally by <a href="https://a.singlediv.com/">Lynn Fisher</a>
</div>
              
            
!

CSS

              
                html, body {
    height : 100%;
}

body {
    display             : flex;
    flex-direction      : column;
    justify-content     : center;
    align-items         : center;
    font-family         : sans-serif;
    background-color    : #ccc;
    background-image    : linear-gradient(45deg, #80808010 25%, transparent 25%),
    linear-gradient(-45deg, #80808010 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #80808010 75%),
    linear-gradient(-45deg, transparent 75%, #80808010 75%);
    background-size     : 30px 30px;
    background-position : 0 0, 0 15px, 15px -15px, -15px 0;
    margin              : 0;
}

.credits {
    position : absolute;
    bottom   : 10px;
}

.container {
    box-shadow    : 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius : 6px;
    background    : #fff;
    padding       : 1em;
}

h1 {
    margin     : 0 0 .5em 0;
    text-align : center;
    color      : #333;
}

.dog-editor {
    --track-background-color        : #efefef;
    --track-border-color            : #b2b2b2;
    --track-active-background-color : #0075ff;
    --track-active-border-color     : #4b76bb;
    display                         : flex;
    flex-flow                       : row-reverse wrap;
    width                           : 11em;
    height                          : 10em;
    position                        : relative;
    justify-content                 : flex-end;
    padding-left                    : 11em;
}

.dog-editor input {
    display : none;
}

.dog-editor .range-segment {
    position     : relative;
    top          : 4px;
    width        : 16px;
    height       : 6px;
    background   : var(--track-background-color);
    border-block : 1px solid var(--track-border-color);
    display      : flex;
    align-items  : center;
    cursor       : pointer;
}

.dog-editor .range-segment.start {
    border-top-left-radius    : 8px;
    border-bottom-left-radius : 8px;
    border-inline-start       : 1px solid var(--track-border-color);
    width                     : 14px;
}

.dog-editor .range-segment.end {
    border-top-right-radius    : 8px;
    border-bottom-right-radius : 8px;
    border-inline-end          : 1px solid var(--track-border-color);
}

.dog-editor input[name="nose-size"]:checked ~ .range-segment.nose-size,
.dog-editor input[name="eye-size"]:checked ~ .range-segment.eye-size,
.dog-editor input[name="dog-size"]:checked ~ .range-segment.dog-size {
    background   : var(--track-active-background-color);
    border-color : var(--track-active-border-color);
}

.dog-editor :checked + .range-segment::before {
    content       : "";
    width         : 16px;
    height        : 16px;
    background    : var(--track-active-background-color);
    position      : absolute;
    border-radius : 100%;
    margin-left   : 1px;
}

.dog-editor :last-of-type:checked + .range-segment::before {
    margin-left : -1px;
}

.dog {
    --background-color : #E0D7FF;
    --collar-color     : #000;
    --medallion        : #daa520;
    --eye-size         : 1%;
    --nose-size        : 12%;
    --medallion-size   : 15%;
    --head-size        : 37%;
    --dog-brightness   : 15%;
    --dog-color        : hsl(39deg, 77%, calc(82% - var(--dog-brightness)));
    --dog-size         : 1;
    --ear-offset       : 0%;

    position           : absolute;
    left               : 0;
    display            : flex;
    background-color   : var(--background-color);
    justify-content    : center;
    align-items        : center;
    overflow           : hidden;
    aspect-ratio       : 1 / 1;
    width              : 10em;
    border-radius      : 6px;
}

/* CSS for the dog originally created by Lynn Fisher, https://a.singlediv.com/ */
.dog::before {
    content             : "";
    font-size           : .7em;
    top                 : 0;
    width               : 100%;
    height              : 100%;
    position            : absolute;
    background-repeat   : no-repeat;
    background-image    : /*Left eye*/ radial-gradient(circle, #000 50%, #00000000 51%),
        /*Right eye*/ radial-gradient(circle, #000 50%, #00000000 51%),
        /*Nose*/ radial-gradient(ellipse, black 50%, #00000000 52%),
        /*Nose area*/ radial-gradient(ellipse, rgba(255, 255, 255, 0.5) 50%, #00000000 51%),
        /*Head*/ radial-gradient(ellipse at 50% 20%, var(--dog-color) 60%, #00000000 61%),
        /*Medallion*/ radial-gradient(circle, var(--medallion) 50%, rgba(218, 165, 32, 0) 51%),
        /*Collar*/ radial-gradient(ellipse at 50% 20%, var(--collar-color) 60%, rgba(220, 20, 60, 0) 61%),
        /*Body*/ radial-gradient(ellipse at 50% 80%, var(--dog-color) 60%, #00000000 61%),
        /*Left ear*/ radial-gradient(ellipse at 0 100%, var(--dog-color) 60%, #00000000 61%),
        /*Right ear*/ radial-gradient(ellipse at 100% 100%, var(--dog-color) 60%, #00000000 61%),
        /*Left foot*/ radial-gradient(ellipse at 60% 80%, var(--dog-color) 60%, #00000000 61%),
        /*Right foot*/ radial-gradient(ellipse at 20% 80%, var(--dog-color) 60%, #00000000 61%);
    background-size     : /*Left eye*/ calc(10% + var(--eye-size)) calc(10% + var(--eye-size)),
        /*Right eye*/ calc(10% + var(--eye-size)) calc(10% + var(--eye-size)),
        /*Nose*/ calc(var(--nose-size) * 1.5) var(--nose-size),
        /*Nose area*/ 42% 30%,
        /*Head*/ calc(var(--head-size) * 2) var(--head-size),
        /*Medallion*/ var(--medallion-size) var(--medallion-size),
        /*Collar*/ 60% 37%,
        /*Body*/ 60% 45%,
        /*Left ear*/ 23% 30%,
        /*Right ear*/ 23% 30%,
        /*Left foot*/ 18% 9%,
        /*Right foot*/ 18% 9%;
    background-position : /*Left eye*/ 35% 57%,
        /*Right eye*/ 65% 57%,
        /*Nose area*/ 50% 70%,
        /*Head*/ 50% 77%,
        /*Medallion*/ 50% 75%,
        /*Medallion*/ 50% calc(82% + var(--medallion-size)),
        /*Collar*/ 50% 84%,
        /*Body*/ 50% 100%,
        /*Left ear*/ 25.5% calc(42% - var(--ear-offset)),
        /*Right ear*/ 74.5% calc(42% - var(--ear-offset)),
        /*Left foot*/ 18% 100%,
        /*Right foot*/ 82% 100%;
    transform           : scale(var(--dog-size));
    transform-origin    : center bottom;
    transition          : transform .2s ease-in-out, background-size .2s ease-in-out;
}

.label {
    font-size : .9em;
    width     : 6.6em;
}

.eye-size {
    margin-top : .5em;
}

.nose-size,
.dog-size,
.collar-color,
.background-color {
    margin-top : 1em;
}

/* region Eye size */

#eye-size1:checked ~ .dog {
    --eye-size : -5%;
}

#eye-size2:checked ~ .dog {
    --eye-size : -4%;
}

#eye-size3:checked ~ .dog {
    --eye-size : -3%;
}

#eye-size4:checked ~ .dog {
    --eye-size : -2%;
}

#eye-size5:checked ~ .dog {
    --eye-size : -1%;
}

/* endregion */

/* region Nose size */

#nose-size1:checked ~ .dog {
    --nose-size : 10%;
}

#nose-size2:checked ~ .dog {
    --nose-size : 12%;
}

#nose-size3:checked ~ .dog {
    --nose-size : 14%;
}

#nose-size4:checked ~ .dog {
    --nose-size : 16%;
}

#nose-size5:checked ~ .dog {
    --nose-size : 18%;
}

/* endregion */

/* region Dog size */

#dog-size1:checked ~ .dog {
    --dog-size : .8;
}

#dog-size2:checked ~ .dog {
    --dog-size : .9;
}

#dog-size3:checked ~ .dog {
    --dog-size : 1;
}

#dog-size4:checked ~ .dog {
    --dog-size : 1.1;
}

#dog-size5:checked ~ .dog {
    --dog-size : 1.2;
}

/* endregion */

/* region Collar color */

label.collar-color,
label.background-color {
    width             : 1.1em;
    height            : 1.1em;
    cursor            : pointer;
    border-radius     : 3px;
    margin-inline-end : 2px;
}

label[for="collar-color1"] {
    background   : #db405f;
    border-color : #db405f
}

label[for="collar-color2"] {
    background   : #5343e6;
    border-color : #5343e6;
}

label[for="collar-color3"] {
    background   : #578f29;
    border-color : #578f29;
}

label[for="collar-color4"] {
    background   : #b440db;
    border-color : #b440db;
}

[name="collar-color"]:checked + label {
    outline        : 1px solid #fff;
    outline-offset : -2px;
}

#collar-color1:checked ~ .dog {
    --collar-color : #db405f;
}

#collar-color2:checked ~ .dog {
    --collar-color : #5343e6;
}

#collar-color3:checked ~ .dog {
    --collar-color : #578f29;
}

#collar-color4:checked ~ .dog {
    --collar-color : #b440db;
}

/* endregion */

/* region Background color */

[for="background-color1"] {
    border-top-left-radius    : 6px;
    border-bottom-left-radius : 6px;
    background                : #CCF1FF;
}

[for="background-color2"] {
    background : #E0D7FF;
}

[for="background-color3"] {
    background : #ffe6c7;
}

[for="background-color4"] {
    border-top-right-radius    : 6px;
    border-bottom-right-radius : 6px;
    background                 : #C1E1C1;
}

[name="background-color"]:checked + label {
    outline        : 1px solid #fff;
    outline-offset : -2px;
}


#background-color1:checked ~ .dog {
    --background-color : #CCF1FF;
}

#background-color2:checked ~ .dog {
    --background-color : #E0D7FF;
}

#background-color3:checked ~ .dog {
    --background-color : #ffe6c7;
}

#background-color4:checked ~ .dog {
    --background-color : #C1E1C1;
}

/* endregion */

              
            
!

JS

              
                
              
            
!
999px

Console