Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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 id="parts">
        <div class="part part1">
           <p>Hey</p>
           <p>Let's</p>
           <p>Have Fun</p>
        </div>
        <div class="part part2">
            <p>Relax,</p>
            <p>Take</p>
            <p>It Easy</p>
        </div>
        <div class="part part3">
            <p>Make</p>
            <p>It</p>
            <p>True</p>
        </div>
        <div class="part part4">
            <p>Give</p>
            <p>All</p>
            <p>The Best</p>
        </div>
        <div class="part part5">
            <p>Live</p>
            <p>In</p>
            <p>The Moment</p>
        </div>
   </div>
              
            
!

CSS

              
                * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
body {
    background-color:#1C0602;
    font-family: 'Merienda One', cursive;
    color: #FFEACE;
    font-size: 20px;
}
#parts {
   min-height: 100vh;
   overflow: hidden;
   display: flex; /*flex container*/
}
.part {
    text-align: center;
    flex: 1; /*flex item, każdy zajmuje tyle samo miejsca czyli 1*/
    display: flex; /*flex container dla el. p*/
    justify-content: center;
    flex-direction: column; /*ustawia w kolumnach flex-items czyli tutaj p*/
    transition: 
        font-size .7s,
        flex .7s;
}
.part.open {
    font-size: 2em;
    flex: 5; /*kiedy panel jest otwarty zajmuje 5*więcej miejsca niż panel zamkniety*/
}
.part p {
    width: 100%;
    flex: 1 0 auto;
    display: flex; /*flex container dla p*/
    justify-content: center;
    align-items: center;
    transition: transform .5s;
}
.part p:nth-child(2) {
    font-size: 2em;
    text-transform: uppercase;
}
.part p:first-child {
    transform: translateY(-100%); /*znikają górne napisy*/
}
.part.open-active p:first-child {
    transform: translateY(0); /*pojawiają się górne napisy*/
}
.part p:last-child {
    transform: translateY(100%); /*znikają dolne napisy*/
}
.part.open-active p:last-child {
    transform: translateY(0); /*pojawiają się dolne napisy*/
}
.part1 {
    background-color: #FF992C;
}
.part2 {
    background-color: #F27823;
}
.part3 {
    background-color: #F26320;
}
.part4 {
    background-color: #BF3E18;
}
.part5 {
    background-color: #8C1D0C;
}

@media screen and (max-width: 1000px) {
    body {
        font-size: 10px;
    }
    .part.open {
        font-size: 1.8em;
        flex: 3;
    }
    .part p:nth-child(2) {
        font-size: 2em;
    }
}
@media screen and (max-width: 530px) {
    body {
        font-size: 6px;
    }
}
              
            
!

JS

              
                const parts = document.querySelectorAll('.part');

function toggleOpen() {
    this.classList.toggle('open');
}

function toggleActive(e) {
    if(e.propertyName.includes('flex')) {
        this.classList.toggle('open-active');
    }
}
parts.forEach(part => part.addEventListener('click', toggleOpen));
parts.forEach(part => part.addEventListener('transitionend', toggleActive)); 
              
            
!
999px

Console