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>#4 alternating images and paragraphs of text - 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>
            <article>
                <img src="https://images.unsplash.com/photo-1532289608746-8aaaa40620f8?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=600&q=80" alt="Mobile phone near a laptop" />
                <div class="content">
                  <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>
            </article>
            <article>
              <img src="https://images.unsplash.com/photo-1579412690850-bd41cd0af397?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=600&q=80" alt="Curved computer display on a table" />
              <div class="content">
                <h1>Headline #2</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 #2</a>
              </div>
            </article>
            <article>
              <img src="https://images.unsplash.com/photo-1526498460520-4c246339dccb?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=600&q=80" alt="Mobile phone with black screen" />
              <div class="content">
                <h1>Headline #3</h1>
                <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum rhoncus urna sed mauris facilisis convallis. Nam blandit, ante ut ultricies iaculis, sem ligula molestie ipsum, mollis iaculis diam urna eget massa. Nam ultrices, leo sed iaculis egestas, sem eros tincidunt turpis, ac malesuada massa purus vel elit. Etiam sagittis enim in commodo ultrices. Nunc laoreet nisi lacus, sit amet sagittis nunc tincidunt et.</p>
                <p>Mauris mattis aliquet dui, sed facilisis purus auctor in. Quisque tincidunt quam eget orci vestibulum porttitor. Nulla semper congue magna sit amet imperdiet. Integer.</p>
                <a class="cta" href="#" title="CTA">CTA #3</a>
              </div>
            </article>
        </main>
    </body>
</html>
              
            
!

CSS

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

main
    width: 50%
    margin: auto

article
    display: grid
    grid-template-columns: 50% 50%
    align-items: center

    &:nth-child(odd)
        text-align: right
    
        img
            grid-column: 2
        .content
            grid-column: 1
            grid-row: 1

    img
        grid-column: 1

    .content
        grid-column: 2
      
        p
            display: inline-block
      
        .cta
            display: block
            margin: 10px auto 0

        

/* other styles */ 
article
    font-family: Roboto, sans-serif
  
    img
        width: 100%

    .content
        padding: 50px
        box-sizing: border-box

    h1
        font-size: 1.5rem
    p
        font-size: .9rem
        
.cta
    width: 180px
    height: 40px
    border-radius: 20px
    border: 2px solid #000
    line-height: 40px
    text-align: center
    font-size: 1.1rem
    color: #000
    text-decoration: none
    margin-top: 10px
    position: relative
    box-sizing: border-box

    &:hover
        background: #000
        color: #fff
        &::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