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>#1 vertically and horizontally centered card - grid</title>
        <link href="https://fonts.googleapis.com/css2?family=Jua&family=Roboto:wght@300&display=swap" rel="stylesheet"> 
        <link rel="stylesheet" href="./assets/css/main.css">
    </head>
    <body>
        <main>
            <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>
        </main>
    </body>
</html>
              
            
!

CSS

              
                /* layout relevant styles */
html, body
    width: 100%
    height: 100%
    margin: 0
  
main
    display: grid
    height: 100%
    grid-template-columns: auto 33% auto
    grid-template-rows: auto auto auto
  
.card
    display: grid
    grid-template-columns: 100%
    grid-template-rows: 48px auto 60px
    grid-column: 2
    grid-row: 2

    .cta
        justify-self: center



/* other styles */
.card
    padding: 50px
    color: #fff
    border-radius: 20px
    box-sizing: border-box
    font-family: Roboto, sans-serif

    &.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
        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