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

              
                .top-navigation
    .social-icons
        .icon
            a.link(href=''): span.ion-social-twitter
        .icon
            a.link(href=''): span.ion-social-instagram
        .icon
            a.link(href=''): span.ion-social-pinterest
    .contacts
        .tel +8 (495) 123-45-67
.hero-header
    img.background(src='http://placehold.it/1920x1080/56638A/46537A')
    .content
        h1.logo company logo
        p.text Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eligendi, nihil!
        a.button.-call-to-action(href='') click!
    .scroll-icon
        span.ion-mouse
.main-navigation
    .container
        h2.logo company logo
        .links-list
            a.link(href='') Home
            a.link(href='') About
            a.link(href='') Catalog
            a.link(href='') Contacts
section.content-section.-about-us
    .container
        h3.title About us
        p.content Lorem ipsum dolor sit amet, consectetur adipisicing elit. Excepturi sequi repellat, nobis, provident tempore exercitationem quaerat autem, voluptates quam esse hic? Officia sint laboriosam, ducimus fugit nam debitis dolores et vitae labore molestias. Perspiciatis asperiores soluta itaque sint quaerat quod, illo odit, consequuntur facilis veniam suscipit commodi beatae quos numquam!
section.content-section.-catalog
    .container
        h3.title Catalog
        .main-catalog
            .catalog-item
                img.thumb(src='http://placehold.it/300x300/56638A/46537A')
                .title Lorem ipsum dolor.
                .description Lorem ipsum dolor sit amet, consectetur adipisicing elit. Natus, voluptatem.
            .catalog-item
                img.thumb(src='http://placehold.it/300x300/56638A/46537A')
                .title Lorem ipsum dolor.
                .description Lorem ipsum dolor sit amet, consectetur adipisicing elit. Natus, voluptatem.
            .catalog-item
                img.thumb(src='http://placehold.it/300x300/56638A/46537A')
                .title Lorem ipsum dolor.
                .description Lorem ipsum dolor sit amet, consectetur adipisicing elit. Natus, voluptatem.
            .catalog-item
                img.thumb(src='http://placehold.it/300x300/56638A/46537A')
                .title Lorem ipsum dolor.
                .description Lorem ipsum dolor sit amet, consectetur adipisicing elit. Natus, voluptatem.
section.content-section.-contacts
    .container
        h3.title Contacts
        .contacts-map-block
            .map
            .text
                p Lorem ipsum dolor sit amet, consectetur adipisicing elit. Enim nostrum, at perferendis necessitatibus officia vel.
                a.button.-call-to-action(href='') click!
footer.page-footer
    .copyright Ivan Bogachev
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Montserrat');

@use postcss-nested;

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    font-family: 'Montserrat', sans-serif;
    font-size: calc( 12px + (20 - 12) * ((100vw - 400px) / ( 1200 - 400)));
    
    --white: #FFFFFF;
    --black: #1C1C1C;
    --grey: #F4F4F4;
    --brand-color: #56638A;
    --shadow-color: rgba(0, 0, 0, .1);
    
    --white-o: rgba(255, 255, 255, .8);
}

.container {
    margin: 0 auto;
    width: 90%;
    max-width: 50rem;
    
    &:after {
        content: '';
        display: table;
        clear: both;
    }
}

.top-navigation {
    position: absolute;
    top: 0;
    left: 0;
    height: 3rem;
    width: 100%;
    padding: 0 1rem;
    z-index: 1;
    background: var(--white-o);
    
    &:after {
        content: '';
        display: table;
        clear: both;
    }
    
    > .social-icons {
        float: left;
    }
    
    > .contacts {
        float: right;
        line-height: 3rem;
    }
}


.social-icons {
    line-height: 3rem;
    
    > .icon {
        float: left;
        font-size: 1.5rem;
        
        & + .icon {
            margin-left: .5rem;
        }
    }
    
    > .icon > .link {
        color: var(--black);
    }
}


.hero-header {
    position: relative;
    overflow: hidden;
    height: 100vh;
    width: 100%;
    min-height: 20rem;
    
    > .background {
        height: inherit;
        width: inherit;
        object-fit: cover;
	    font-family: 'object-fit: cover;'
    }
    
    > .content {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translateX(-50%) translateY(-50%);
        width: 100%;
        padding: 1rem 2rem;
        text-align: center;
        color: var(--white)
    }
    
    > .content > .logo {
        font-size: 2rem;
        text-transform: uppercase;
        margin: 0 0 .5rem;
    }
    
    > .content > .text {
        
    }
    
    > .content > .button {
        margin-top: 2rem;
    }
    
    > .scroll-icon {
        position: absolute;
        bottom: 2rem;
        left: 50%;
        transform: translateX(-50%);
        font-size: 2rem;
    }
}


.button {
    display: inline-block;
    background: var(--black);
    color: var(--white);
    font-size: 1rem;
    line-height: 2em;
    padding: 0 1em;
    text-decoration: none;
    
    &.-call-to-action {
        font-size: 1.25rem;
    }
}


.main-navigation {
    height: 3rem;
    box-shadow: 0 .3rem .5rem var(--shadow-color);
    
    > .container > .logo {
        text-transform: uppercase;
        line-height: 3rem;
        font-size: 1.25rem;
        float: left;
        margin: 0;
    }
    
    > .container > .links-list {
        float: right;
    }
}


.links-list {
    > .link {
        line-height: 3rem;
        text-decoration: none;
        color: var(--black);
        
        & + .link {
            margin-left: 1rem;
        }
    }
}


.content-section {
    padding: 4rem 0 5rem;
    
    > .container {
        margin: 1rem auto;
    }
    
    > .container > .title {
        font-size: 1.5rem;
        text-transform: uppercase;
        text-align: center;
        margin-bottom: 3rem;
        position: relative;
        
        &:after {
            content: '';
            background: var(--brand-color);
            position: absolute;
            bottom: -.5rem;
            left: 50%;
            transform: translateX(-50%) translateY(50%);
            height: .3rem;
            width: 5rem;
        }
        
        &:before {
            content: '';
            background: var(--brand-color);
            position: absolute;
            bottom: -.9rem;
            left: 50%;
            transform: translateX(-2.2rem);
            height: .8rem;
            width: .8rem;
            border-radius: 50%;
        }
    }
    
    &.-about-us {
        margin-top: 2rem;
    }
    
    &.-catalog {
        background: var(--grey);
        > .container > .title:before {
            transform: translateX(-50%);
        }
    }
    
    &.-contacts {
        > .container > .title:before {
            transform: translateX(1.4rem);
        }
    }
}


.catalog-item {
    width: 50%;
    float: left;
    margin-bottom: 2rem;
    
    &:nth-of-type(2n) {
        padding-left: 1rem;
    }
    &:nth-of-type(2n+1) {
        padding-right: 1rem;
    }
    
    > .thumb {
        width: 100%;
        margin-bottom: .5rem;
    }
    
    > .title {
        text-transform: uppercase;
        font-size: 1.25rem;
        margin-bottom: .5rem;
    }
}


.contacts-map-block {
    > .map {
        height: 10rem;
        width: 50%;
        background: var(--brand-color);
        float: left;
    }
    
    > .text {
        padding-left: 2rem;
        width: 50%;
        float: right;
    }
    
    > .text > .button {
        margin-top: 1rem;
    }
}

.page-footer {
    height: 3rem;
    line-height: 3rem;
    background: var(--black);
    color: var(--white);
    text-align: center;
}
              
            
!

JS

              
                /*! npm.im/object-fit-images 3.1.3 */
var objectFitImages=function(){"use strict";function t(t,e){return"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='"+t+"' height='"+e+"'%3E%3C/svg%3E"}function e(t){if(t.srcset&&!p&&window.picturefill){var e=window.picturefill._;t[e.ns]&&t[e.ns].evaled||e.fillImg(t,{reselect:!0}),t[e.ns].curSrc||(t[e.ns].supported=!1,e.fillImg(t,{reselect:!0})),t.currentSrc=t[e.ns].curSrc||t.src}}function i(t){for(var e,i=getComputedStyle(t).fontFamily,r={};null!==(e=u.exec(i));)r[e[1]]=e[2];return r}function r(e,i,r){var n=t(i||1,r||0);b.call(e,"src")!==n&&h.call(e,"src",n)}function n(t,e){t.naturalWidth?e(t):setTimeout(n,100,t,e)}function c(t){var c=i(t),o=t[l];if(c["object-fit"]=c["object-fit"]||"fill",!o.img){if("fill"===c["object-fit"])return;if(!o.skipTest&&f&&!c["object-position"])return}if(!o.img){o.img=new Image(t.width,t.height),o.img.srcset=b.call(t,"data-ofi-srcset")||t.srcset,o.img.src=b.call(t,"data-ofi-src")||t.src,h.call(t,"data-ofi-src",t.src),t.srcset&&h.call(t,"data-ofi-srcset",t.srcset),r(t,t.naturalWidth||t.width,t.naturalHeight||t.height),t.srcset&&(t.srcset="");try{s(t)}catch(t){window.console&&console.log("https://bit.ly/ofi-old-browser")}}e(o.img),t.style.backgroundImage='url("'+(o.img.currentSrc||o.img.src).replace(/"/g,'\\"')+'")',t.style.backgroundPosition=c["object-position"]||"center",t.style.backgroundRepeat="no-repeat",/scale-down/.test(c["object-fit"])?n(o.img,function(){o.img.naturalWidth>t.width||o.img.naturalHeight>t.height?t.style.backgroundSize="contain":t.style.backgroundSize="auto"}):t.style.backgroundSize=c["object-fit"].replace("none","auto").replace("fill","100% 100%"),n(o.img,function(e){r(t,e.naturalWidth,e.naturalHeight)})}function s(t){var e={get:function(e){return t[l].img[e?e:"src"]},set:function(e,i){return t[l].img[i?i:"src"]=e,h.call(t,"data-ofi-"+i,e),c(t),e}};Object.defineProperty(t,"src",e),Object.defineProperty(t,"currentSrc",{get:function(){return e.get("currentSrc")}}),Object.defineProperty(t,"srcset",{get:function(){return e.get("srcset")},set:function(t){return e.set(t,"srcset")}})}function o(){function t(t,e){return t[l]&&t[l].img&&("src"===e||"srcset"===e)?t[l].img:t}d||(HTMLImageElement.prototype.getAttribute=function(e){return b.call(t(this,e),e)},HTMLImageElement.prototype.setAttribute=function(e,i){return h.call(t(this,e),e,String(i))})}function a(t,e){var i=!y&&!t;if(e=e||{},t=t||"img",d&&!e.skipTest||!m)return!1;"string"==typeof t?t=document.querySelectorAll(t):"length"in t||(t=[t]);for(var r=0;r<t.length;r++)t[r][l]=t[r][l]||{skipTest:e.skipTest},c(t[r]);i&&(document.body.addEventListener("load",function(t){"IMG"===t.target.tagName&&a(t.target,{skipTest:e.skipTest})},!0),y=!0,t="img"),e.watchMQ&&window.addEventListener("resize",a.bind(null,t,{skipTest:e.skipTest}))}var l="bfred-it:object-fit-images",u=/(object-fit|object-position)\s*:\s*([-\w\s%]+)/g,g="undefined"==typeof Image?{style:{"object-position":1}}:new Image,f="object-fit"in g.style,d="object-position"in g.style,m="background-size"in g.style,p="string"==typeof g.currentSrc,b=g.getAttribute,h=g.setAttribute,y=!1;return a.supportsObjectFit=f,a.supportsObjectPosition=d,o(),a}();

document.addEventListener('DOMContentLoaded', () => {
    objectFitImages();
});
              
            
!
999px

Console