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

              
                <main>
  <div class="article--post-container">
    <article class="article--post">
      <header>
        <div class="article--post__image rounded-lg w-20 h-20">
          <figure role="presentation" class="bio-image">
            <!--  target=_blank added just due to being in a CodePen -->
            <a target="_blank" href="/author/stephanie-eckles" class="bio-image-link">
              <div class="bio-image-wrapper">
                <picture>
                  <img class="bio-image-image" src="https://cloud.netlifyusercontent.com/assets/344dbf88-fdf9-42bb-adb4-46f01eedd629/298e8d06-3c8c-4644-a8be-1151f35d8a7f/stephanie-eckles-200x200.jpg" width="100" height="100" alt="Stephanie Eckles">
                </picture>
              </div>
            </a>
          </figure>
        </div>
        <span class="article--post__author-name">
          <a target="_blank" class="red" href="/author/stephanie-eckles">Stephanie Eckles</a>
          <em class="light-grey">wrote</em>
        </span>
        <h2 class="article--post__title"><a target="_blank" href="https://www.smashingmagazine.com/2021/05/complete-guide-css-container-queries/">A Primer On CSS Container Queries</a></h2>
      </header>
      <footer class="article--post__stats">
        <ul>
          <li class="article--post__reading-time"><span class="small-caps">22</span> min read</li>
          <li class="article--post__comments-count"><a target="_blank" href="https://www.smashingmagazine.com/2021/05/complete-guide-css-container-queries/"><span data-component="CommentsCount" data-insert="true" data-thread="/2021/04/guide-supported-modern-css-pseudo-class-selectors/"><span><span class="small-caps">0</span> comments</span></span></a></li>
        </ul>
      </footer>
      <div class="article--post__content">
        <p class="article--post__teaser"><time datetime="2021-04-23" class="article--post__time">May 11, 2021 —</time>
          A prototype of the long-awaited CSS container queries has landed in Chrome Canary and is available for experimentation. Let’s look at what problem is being solved, learn how container queries work, and see how they compare with and complement existing CSS features for layout.
          <a target="_blank" href="https://www.smashingmagazine.com/2021/05/complete-guide-css-container-queries/" class="read-more-link">Read more…</a>
        </p>
      </div>
    </article>
  </div>

  <div class="flex-layout">
    <div class="article--post-container">
      <article class="article--post">
        <header>
          <div class="article--post__image rounded-lg w-20 h-20">
            <figure role="presentation" class="bio-image">
              <a target="_blank" href="https://www.smashingmagazine.com/author/stephanie-eckles" class="bio-image-link">
                <div class="bio-image-wrapper">
                  <picture>
                    <img class="bio-image-image" src="https://cloud.netlifyusercontent.com/assets/344dbf88-fdf9-42bb-adb4-46f01eedd629/298e8d06-3c8c-4644-a8be-1151f35d8a7f/stephanie-eckles-200x200.jpg" width="100" height="100" alt="Stephanie Eckles">
                  </picture>
                </div>
              </a>
            </figure>
          </div>
          <span class="article--post__author-name">
            <a target="_blank" class="red" href="https://www.smashingmagazine.com/author/stephanie-eckles">Stephanie Eckles</a>
            <em class="light-grey">wrote</em>
          </span>
          <h2 class="article--post__title"><a target="_blank" href="https://www.smashingmagazine.com/2021/04/guide-supported-modern-css-pseudo-class-selectors/">A Guide To Newly Supported, Modern CSS Pseudo-Class Selectors</a></h2>
        </header>
        <footer class="article--post__stats">
          <ul>
            <li class="article--post__reading-time"><span class="small-caps">11</span> min read</li>
            <li class="article--post__comments-count"><a target="_blank" href="https://www.smashingmagazine.com/2021/04/guide-supported-modern-css-pseudo-class-selectors/#comments-guide-supported-modern-css-pseudo-class-selectors"><span data-component="CommentsCount" data-insert="true" data-thread="/2021/04/guide-supported-modern-css-pseudo-class-selectors/"><span><span class="small-caps">3</span> comments</span></span></a></li>
          </ul>
        </footer>
        <div class="article--post__content">
          <p class="article--post__teaser"><time datetime="2021-04-23" class="article--post__time">April 23, 2021 —</time>
            The CSS Working Group Editor’s Draft for <a href="https://drafts.csswg.org/selectors-4/">Selectors Level 4</a> includes several pseudo-class selectors that already have proposal candidates in most modern browsers. This guide will cover ones that currently have the best support along with examples to demonstrate how you can start using them today!
            <a target="_blank" href="https://www.smashingmagazine.com/2021/04/guide-supported-modern-css-pseudo-class-selectors/" class="read-more-link">Read more…</a>
          </p>
        </div>
      </article>
    </div>
    <div class="article--post-container">
      <article class="article--post">
        <header>
          <div class="article--post__image rounded-lg w-20 h-20">
            <figure role="presentation" class="bio-image">
              <a target="_blank" href="https://www.smashingmagazine.com/author/stephanie-eckles" class="bio-image-link">
                <div class="bio-image-wrapper">
                  <picture>
                    <img class="bio-image-image" src="https://cloud.netlifyusercontent.com/assets/344dbf88-fdf9-42bb-adb4-46f01eedd629/298e8d06-3c8c-4644-a8be-1151f35d8a7f/stephanie-eckles-200x200.jpg" width="100" height="100" alt="Stephanie Eckles">
                  </picture>
                </div>
              </a>
            </figure>
          </div>
          <span class="article--post__author-name">
            <a target="_blank" class="red" href="https://www.smashingmagazine.com/author/stephanie-eckles">Stephanie Eckles</a>
            <em class="light-grey">wrote</em>
          </span>
          <h2 class="article--post__title"><a target="_blank" href="https://www.smashingmagazine.com/2021/03/eleventy-static-site-generator/">A Deep Dive Into Eleventy Static Site Generator</a></h2>
        </header>
        <footer class="article--post__stats">
          <ul>
            <li class="article--post__reading-time"><span class="small-caps">19</span> min read</li>
            <li class="article--post__comments-count"><a target="_blank" href="https://www.smashingmagazine.com/2021/03/eleventy-static-site-generator/"><span data-component="CommentsCount" data-insert="true" data-thread="/2021/04/guide-supported-modern-css-pseudo-class-selectors/"><span><span class="small-caps">1</span> comments</span></span></a></li>
          </ul>
        </footer>
        <div class="article--post__content">
          <p class="article--post__teaser"><time datetime="2021-04-23" class="article--post__time">March 24, 2021 —</time>
            Eleventy (aka 11ty) is rising in the ranks among static site generators. This Node-based builder is attractive due to its zero-config starting point, purely static output, and ease of achieving the coveted top Lighthouse performance score of four perfect 100s. Let’s dive into what else makes it unique, and learn about some essential concepts to help you successfully get started.
            <a target="_blank" href="https://www.smashingmagazine.com/2021/03/eleventy-static-site-generator/" class="read-more-link">Read more…</a>
          </p>
        </div>
      </article>
    </div>
  </div>
</main>
              
            
!

CSS

              
                // Learn more about container queries: https://www.smashingmagazine.com/2021/05/complete-guide-css-container-queries/

// Updated styles using container queries and grid

// Assign a new div as a container
.article--post-container {
  container-type: inline-size;
}

// Update from previous layout styles to use grid
.article--post {
  display: grid;
  grid-template-areas: "header" "stats" "content";
  gap: 0.5rem;
}

.article--post header {
  grid-area: header;

  display: grid;
  grid-template-areas:
    "avatar name"
    "headline headline";
  grid-auto-columns: auto 1fr;
  align-items: center;
  column-gap: 1rem;
  row-gap: 0.5rem;
}

.article--post__stats {
  grid-area: stats;
}

.article--post__content {
  grid-area: content;
}

.article--post__image {
  grid-area: avatar;
}

.article--post__author-name {
  grid-area: name;
}

.article--post__title {
  grid-area: headline;
  font-size: 1.5rem;
}

.article--post__stats ul {
  display: flex;
  gap: 1rem;
  margin: 0;
}

.article--post__teaser {
  margin: 0;
}

// Adjust with a container query! This is our "middle" sized container
@container (min-width: 60ch) {
  .article--post header {
    grid-template-areas:
      "avatar name"
      "avatar headline";
    align-items: start;
  }

  .article--post {
    grid-template-areas: "header header" ". stats" ". content";
    grid-auto-columns: 5rem 1fr;
    column-gap: 1rem;
  }

  .article--post__title {
    font-size: 1.75rem;
  }
}

@container (min-width: 100ch) {
  .article--post {
    grid-template-areas: "header header header" ". content stats";
    grid-auto-columns: 5rem fit-content(70ch) auto;
  }

  .article--post__stats ul {
    flex-direction: column;
  }

  .article--post__title {
    max-width: 80ch;
    font-size: 2rem;
  }

  .article--post__content {
    padding-right: 2em;
  }
}

// Flex layout to show the container queries are really working
.flex-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 5vw;
  margin-top: 5vh;
}

.flex-layout > * {
  flex: 1 1 45ch;
}

// Styles from Smashing Magazine
* {
  box-sizing: border-box;
}

body {
  font-feature-settings: "onum" 1;
  line-height: 1.5;
  color: #333;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-family: -apple-system, Arial, BlinkMacSystemFont, Roboto Slab,
    Droid Serif, Segoe UI, Ubuntu, Cantarell, sans-serif;
}

.bio-image-wrapper {
  background: var(
    --bio-image-background-color,
    var(--bio-image-border-color, #d33a2c)
  );
  border: solid 5px var(--bio-image-border-color, #d33a2c);
  border-radius: inherit;
  transform: scale(0.84) translateX(15%) rotateZ(calc(-1 * (11 * 1deg)));
  transform-origin: 0 100%;
  transition: transform 0.2s ease-out;
  overflow: hidden;
  width: auto;
  height: auto;
}

.bio-image {
  padding: 0;
  margin: 0;
  display: block;
  width: auto;
  height: auto;
  border-radius: inherit;
  position: relative;

  &::before {
    display: block;
    content: "";
    height: 90%;
    width: 160%;
    position: absolute;
    background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAI8AAAASCAYAAABim40OAAACuElEQVRogc1XUZJjIQjEzN7/yMl8ucP0dkNjXrKh6pWAqERaICveR+vD96vo8cazOvoYX54NwOl6Z52ycc907E4C4a45DfKrwHH5vpPgd7aTYKNOyUvYKL7zRZG6WNRP5cne7pxrMwHLEbCqS3aDMglwpcvjMmTGVz4wejQ86lDfjZ0OeSY/az/VMaJ2XQZA/QQQChSKV99N8OpjvuHvUsGt+ErX2bI9q7Hy0dE580pnZ0R1uTi/eSVX2SLrbmKeAeQG34qIL2KDozo/kwosBv4Ouk5WOheMyrfK5t1Z8K++Ak9XVjK/ZRW8LnMgYDZQtpx5lBFoERxI//z40EFmQLgn2R27PZkP0fDVGmaj5thdoE7JEREPBR6nFJ1+CCAFgq9mVF91dhUcBRgGHMWjju0TZN7xi+nVGmaH8wG2IeaUHH+ibyqRTuxZCVGyAhgrZQi0KrtlYgHYAV1JXvET8IjfF7jnb4mPpMtg2TZbr0rpSnwQO9SzjLAauxV83Zj2j1FU9QtX0fQMfD1VM6zWn9D00agz3fOr866OwRF1mUe9EmaDL8d9HflF5jS/M8Yd1rHzsWzt87HMdr0D+sB6HixPXV/EyqH6QvCqBOE9qPXMTsmMqI3TMG9eNc7P9EJYYvK/KdUsZz0raZF06Hu+DCxBD+BZv1L1RKeAcXsZpnNtgtiEmEOeyRHx0zBvchtnHBWAUFa66q86ggltuj5HZU73pVdAcMHhAEX5xHys/Ge/j43IO/IvfZdxmM4FVDdOs1X1Twr3YWciTYPjZopXZILOxgWElVGIjs5V/Yw752QrxU/A1fGdL4yciz551U45qILa+fbsOmeutekud2I7BeJJhmPr3L07KlN0Y/eMzpmb2JzYntgfXfIr9nLWXgl0RuPLO1xzxdqPOPNK8FxJn+rXhP4HON5K31PHDhmjlm6fAAAAAElFTkSuQmCC);
    background-size: 100% auto;
    background-repeat: no-repeat;
    top: 89%;
    left: -30%;
    right: 0;
    transition: all 0.1s ease-out;
    transform-origin: 30% 50%;
    pointer-events: none;
  }
}

.bio-image-image {
  width: 100%;
  height: 100%;
  -o-object-fit: cover;
  object-fit: cover;
  display: block;
  transform: scale(1.2) rotateZ(calc(11 * 1deg));
  transition: transform 0.2s ease-out;
}

a.bio-image-link {
  background: 0 0;
  text-shadow: none;
  color: inherit;
  padding: 0;
  display: block;
  border-radius: inherit;
  width: auto;
  height: auto;

  &::before {
    display: block;
    content: "";
    height: 120%;
    width: 120%;
    position: absolute;
    top: -10%;
    left: -12%;
  }
}

.article--post__author-name {
  color: #666;
  font-weight: 700;
  font-size: calc(0.9em + 0.1vw);
  line-height: 1.1;
}

.article--post__title {
  color: #333;
  margin-top: 0.25em;
  margin-bottom: 0.5em;
  line-height: 1.2;
}

.article--post__stats {
  ul {
    list-style: none;
    padding: 0;
    margin-left: 0;
    margin-top: 0;

    li {
      padding-left: 1.5em;
      margin: 0.1em 0;
      color: #666;
      background-repeat: no-repeat;
      background-size: 1em 1em;
      background-position: left center;
      line-height: 1;
      font-size: 1.15rem;
    }

    li.article--post__reading-time {
      background-image: url(https://www.smashingmagazine.com/images/clock--alt.svg);
    }

    li.article--post__comments-count {
      background-image: url(https://www.smashingmagazine.com/images/comments--alt.svg);
    }
  }
}

.article--post__stats ul li.article--post__comments-count a {
  color: #666;
}

.article--post__title a {
  color: #333;
  text-decoration: none;
  transition: color 0.1s linear;
  padding: 0;

  &:hover,
  &:focus {
    color: #d33a2c;
  }
}

.article--post__content {
  font-size: 1.35rem;
}

.read-more-link {
  text-shadow: none;
  font-weight: 700;
  display: table;
  margin-top: 0.5em;
  text-underline-offset: 5px;
}

.article--post__time {
  font-size: 0.9em;
}

.article-header--meta-item__date,
time {
  font-size: 0.8em;
  color: #666;
  text-transform: lowercase;
  font-feature-settings: "smcp" 1, "c2sc" 1;
  letter-spacing: 1px;
  font-variant: petite-caps;
  text-transform: lowercase;
  background-position: center 72%;
  font-family: -apple-system, Arial, BlinkMacSystemFont, Roboto Slab,
    Droid Serif, Segoe UI, Ubuntu, Cantarell, sans-serif;
}

a {
  text-decoration: none;
  padding: 10px 0;
  transition: color 0.1s ease-out;
  color: #006fc6;
  -webkit-text-decoration-skip: ink;
  text-decoration-skip-ink: auto;
  text-decoration-thickness: 1px;
  text-underline-offset: 1px;
  text-decoration-offset: initial;
  -webkit-text-decoration-line: underline;
  text-decoration-line: underline;
}

.w-20 {
  width: 5rem;
}

.h-20 {
  height: 5rem;
}

.rounded-lg {
  border-radius: 0.694rem;
}

.red {
  color: #d33a2c;
}

.light-grey {
  color: #767676;
}

.small-caps {
  font-feature-settings: "smcp" 1, "c2sc" 1;
  letter-spacing: 1px;
  font-variant: petite-caps;
  text-transform: lowercase;
  background-position: center 72%;
}

@font-face {
  font-family: "Mija";
  src: url("https://assets.codepen.io/1101822/Mija+W03+Bold.ttf");
  font-weight: 700;
}

@font-face {
  font-family: "Elena";
  src: url("https://assets.codepen.io/1101822/Elena-Regular.otf");
  font-weight: 400;
}

@font-face {
  font-family: "Elena";
  src: url("https://assets.codepen.io/1101822/Elena-RegularItalic.otf");
  font-style: italic;
}

.article--post__stats,
time,
body,
.article--post__author-name em {
  font-family: "Elena", serif;
}

.article--post__author-name em {
  font-weight: normal;
}

.article--post__title,
.article--post__author-name,
.read-more-link {
  font-family: "Mija", sans-serif;
  font-weight: 700;
}

.article--post__author-name,
.read-more-link {
  font-size: 1.25rem;
}

p {
  line-height: calc(1.5em + 0.2vw);
}

// Approximate layout
main {
  padding: 8vh 1rem;
  width: min(1400px, 100vw - 2rem);
  margin-inline: auto;
}

              
            
!

JS

              
                
              
            
!
999px

Console