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.

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

              
                <html>
    <head>
        <title>Flexbox sample #2</title>
        <link href="https://fonts.googleapis.com/css2?family=Jua&family=Roboto:wght@300&display=swap" rel="stylesheet">
    </head>
    <body>
        <main>
            <div class="row">
                <div class="card blue">
                    <h1>Headline #1</h1>
                    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vulputate est non neque faucibus elementum.</p>
                    <a class="cta" href="#" title="CTA">CTA #1</a>
                </div>
                <div class="card orange">
                    <h1>Headline #1</h1>
                    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis sollicitudin sagittis luctus. Aliquam erat volutpat. Duis id lacinia massa. Vestibulum diam purus, tempor.</p>
                    <a class="cta" href="#" title="CTA">CTA #1</a>
                </div>
            </div>
        </main>
    </body>
</html>
              
            
!

CSS

              
                /* layout relevant styles */
html, body
    width: 100%
    height: 100%
    margin: 0

body
    display: flex
    flex-direction: row
    align-items: center

    main
        display: flex
        flex-direction: column
        flex-grow: 1
        align-items: center

    .row
        display: flex
        flex-direction: row
        justify-content: center
      
.card
    display: flex
    flex-direction: column
    width: 33%

    .cta
        align-self: center
    
/* other styles */
.card
    width: 33%
    padding: 50px
    color: #fff
    border-radius: 20px
    box-sizing: border-box
    font-family: Roboto, sans-serif
    margin: 0 25px

    &.orange
        background: rgb(251,176,64)
        background: linear-gradient(135deg, rgba(251,176,64,1) 20%, rgba(239,65,54,1) 100%)

    &.blue
        background: rgb(0,174,239)
        background: linear-gradient(135deg, rgba(0,174,239,1) 20%, rgba(45,56,138,1) 100%)

    h1
        margin: 0 
        font-size: 3rem
        font-weight: lighter
        text-align: center

    p
        font-size: 1.5rem
        flex-grow: 1

    .cta
        width: 240px
        height: 50px
        border-radius: 25px
        border: 2px solid #fff
        line-height: 50px
        text-align: center
        font-size: 1.5rem
        color: #fff
        text-decoration: none
        align-self: center
        margin-top: 10px
        position: relative
        box-sizing: border-box

        &:hover
            background: #ffffff
            color: #000
            &::after
                right: 10px

        &::after
            content: ">"
            font-family: "Jua"
            position: absolute
            right: 15px
            transition: right 1s ease

a, a:hover
    transition: all 0.3s ease
              
            
!

JS

              
                
              
            
!
999px

Console