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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

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

              
                <header class="page-header">
  <div class="logo-wrapper">
    <h1>RollingStone</h1>
  </div>
</header>
<main>
  <div class="features">
    <h2 class="visually-hidden">Features</h2>
    <article class="feature col2">
      <h3>Lorem ipsum dolor sit amet, consectetur adipisicing elit</h3>
      <img src="https://assets.codepen.io/297176/austin-neill-725x870.jpg" alt="Just a singer in a rock'n'roll band" title="Foto van Austin Neill unsplash.com/@arstyy ">
    </article>
    <article class="feature col1">
      <h3>Lorem ipsum dolor sit amet</h3>
      <img src="https://picsum.photos/id/110/350/350" alt="">
    </article>
    <article class="feature col1">
      <h3>Lorem ipsum dolor sit amet, consectetur adipisicing</h3>
      <img src="https://picsum.photos/id/118/350/350" alt="">
    </article>
  </div>
  <div class="latest">
    <h2>The Latest</h2>
    <article>
      <header>
        <p>Lorem ipsum</p>
        <h3>Lorem ipsum dolor sit amet, consectetur adipisicing elit</h3>
      </header>
    </article>
    <article>
      <header>
        <p>Lorem ipsum</p>
        <h3>Lorem ipsum dolor sit amet, consectetur adipisicing elit</h3>
      </header>
    </article>
    <article>
      <header>
        <p>Lorem ipsum</p>
        <h3>Lorem ipsum dolor sit amet, consectetur adipisicing elit</h3>
      </header>
    </article>
    <article>
      <header>
        <p>Lorem ipsum</p>
        <h3>Lorem ipsum dolor sit amet, consectetur adipisicing elit</h3>
      </header>
    </article>
    <p><a href="">Meer nieuws</a></p>
  </div>
  <aside class="trending">
    <h2>Trending</h2>
    <ol>
      <li>
        <article>
          <h3>
            <div class="number">
              <span class="counter"></span>
            </div>
            <span>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aliquam commodi expedita natus obcaecati quae vero?</span>
          </h3>
        </article>
      </li>
      <li>
        <article>
          <h3>
            <div class="number">
              <span class="counter"></span>
            </div>
            <span>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aliquam commodi expedita natus obcaecati quae vero?</span>
          </h3>
        </article>
      </li>
      <li>
        <article>
          <h3>
            <div class="number">
              <span class="counter"></span>
            </div>
            <span>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aliquam commodi expedita natus obcaecati quae vero?</span>
          </h3>
        </article>
      </li>
      <li>
        <article>
          <h3>
            <div class="number">
              <span class="counter"></span>
            </div>
            <span>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aliquam commodi expedita natus obcaecati quae vero?</span>
          </h3>
        </article>
      </li>
      <li>
        <article>
          <h3>
            <div class="number">
              <span class="counter"></span>
            </div>
            <span>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aliquam commodi expedita natus obcaecati quae vero?</span>
          </h3>
        </article>
      </li>
    </ol>
  </aside>
</main>
<footer>
  <h2>That's all folks</h2>
</footer>
              
            
!

CSS

              
                /* ----------------
** Dit is de versie met grid-in-grid
** Zie https://codepen.io/dool/pen/oNbWGXg voor
** een uitwerking met de experimentele optie subgrid
** ------------------*/

*,
*::after,
*::before {
  box-sizing: border-box;
}

img {
  display: block;
  height: 100%;
  width: 100%;
}

.visually-hidden {
  clip: rect(1px, 1px, 1px, 1px);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
  transition: all ease-out 0.1s;
}

.visually-hidden:focus {
  all: initial;
}

body {
  counter-reset: trending-counter;
  font-family: Georgia, Times, "Times New Roman", serif;
  font-size: 1rem;
  line-height: 1.5;
}

body,
h1,
h2,
h3,
p {
  margin: 0;
}

li,
ol,
ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

h2,
h3 {
  font-family: neue-haas-unica, sans-serif;
}

.page-header {
  background: crimson;
  height: 100px;
  width: 100%;
  transition: height 0.1s ease-in-out;
}

.logo-wrapper {
  background: white;
  box-shadow: 0 0.25rem 0.25rem 0 hsla(0 0% 0% / 0.2);
  position: fixed;
  text-align: center;
  width: 100%;
  z-index: 1;
}

h1 {
  background: linear-gradient(
    to right,
    #f06ca9,
    #f0608c,
    #ef3f50,
    #ed1e24,
    #f15d22,
    #f58120,
    #f78e1e,
    #f5a31f,
    #f5bd1e,
    #f5d01c,
    #f5de1a,
    #f5e719,
    #f5eb17,
    #e2de25,
    #b3c436,
    #6aa341 50%,
    #078e45,
    #23bdbd,
    #462e8d,
    #8b278a
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  font-family: "Zilla Slab", serif;
  font-size: 2.25rem;
  transition: font-size 0.1s ease-in-out;
}

@media screen and (min-width: 960px) {
  .page-header {
    height: 120px;
  }

  h1 {
    font-size: 5rem;
  }
}

.header-collapse {
  height: 100px;
}

.header-collapse h1 {
  font-size: 2.25rem;
  animation: gradient 0.25s linear;
}

@keyframes gradient {
  0% {
    background: linear-gradient(
      to left,
      #f06ca9,
      #f0608c,
      #ef3f50,
      #ed1e24,
      #f15d22,
      #f58120,
      #f78e1e,
      #f5a31f,
      #f5bd1e,
      #f5d01c,
      #f5de1a,
      #f5e719,
      #f5eb17,
      #e2de25,
      #b3c436,
      #6aa341 50%,
      #078e45,
      #23bdbd,
      #462e8d,
      #8b278a
    );
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }
  100% {
    background: linear-gradient(
      to right,
      #f06ca9,
      #f0608c,
      #ef3f50,
      #ed1e24,
      #f15d22,
      #f58120,
      #f78e1e,
      #f5a31f,
      #f5bd1e,
      #f5d01c,
      #f5de1a,
      #f5e719,
      #f5eb17,
      #e2de25,
      #b3c436,
      #6aa341 50%,
      #078e45,
      #23bdbd,
      #462e8d,
      #8b278a
    );
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }
}

main {
  margin: 0 auto;
  max-width: 81.25rem;
  min-width: 20rem;
  padding: 2rem 1.25rem 1.25rem;
  position: relative;
}

main::before {
  content: "";
  top: 0;
  left: 50%;
  height: 7.1875rem;
  width: 100vw;
  background-color: crimson;
  position: absolute;
  transform: translateX(-50%);
  z-index: -1;
}

@media screen and (min-width: 60rem) {
  main {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: min(15%, 175px) 3fr 18.75rem;
    grid-template-rows: 1fr;
  }

  .features {
    grid-column: 2;
    grid-row: 1;
  }

  .latest {
    grid-column: 1;
    grid-row: 1;
  }

  .trending {
    grid-column: 3;
    grid-row: 1;
  }
}

.features {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
}

@media screen and (min-width: 768px) and (max-width: 959px),
  (min-width: 1100px) {
  .features {
    grid-template-columns: 2fr 26%;
    grid-template-rows: 1fr 1fr;
  }
}

.feature.col2 {
  box-shadow: 0 1.25rem 1.5rem 0 rgba(0, 0, 0, 0.1);
  grid-column: 1 / span 2;
  grid-row: 1;
  position: relative;
}

@media screen and (min-width: 768px) and (max-width: 959px),
  (min-width: 1100px) {
  .feature.col2 {
    grid-column: 1;
    grid-row: 1 / span 2;
  }
}

.filter {
  /*noinspection CssInvalidFunction*/
  background: linear-gradient(
    to bottom,
    hsla(0 0% 0% / 0) 60%,
    hsla(0 0% 0% / 1)
  );
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}

.feature.col2 h3 {
  color: white;
  bottom: 1.25rem;
  font-family: neue-haas-unica, sans-serif;
  font-size: 1.25rem;
  padding: 0 1.25rem;
  position: absolute;
}

.feature:nth-of-type(2) {
  grid-column: 1;
  grid-row: 2;
}

@media screen and (min-width: 768px) and (max-width: 959px),
  (min-width: 1100px) {
  .feature:nth-of-type(2) {
    grid-column: 2;
    grid-row: 1;
  }
}

.feature:nth-of-type(3) {
  grid-column: 2;
}

@media screen and (min-width: 768px) and (max-width: 959px),
  (min-width: 1100px) {
  .feature:nth-of-type(3) {
    grid-column: 2;
    grid-row: 2;
  }
}

.feature.col1 {
  box-shadow: 0 0.125rem 0.75rem 0 rgba(0, 0, 0, 0.08);
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr;
}

.feature.col1 h3 {
  font-family: neue-haas-unica, sans-serif;
  font-weight: 700;
  font-size: 1rem;
  grid-row: 2;
  margin: 0.5rem 1rem 1.25rem;
}

.latest {
  margin-block-start: 1.875rem;
}

.latest h2 {
  color: crimson;
  font-family: neue-haas-unica, sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
}

.latest h3 {
  font-family: reset;
  font-weight: normal;
  font-size: 0.875rem;
  margin-block-end: 2rem;
}

.latest p {
  border-bottom: 1px solid crimson;
  display: inline-block;
  font-family: neue-haas-unica, sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  margin-block-end: 0.25rem;
  text-transform: uppercase;
}

.latest article + p {
  border: none;
  display: block;
  font-family: neue-haas-unica, sans-serif;
  margin-block-end: 2.25rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: right;
  text-transform: none;
}

.latest article + p > a {
  color: crimson;
  text-decoration: none;
}

@media screen and (min-width: 960px) {
  .latest {
    margin-block-start: 0;
  }

  .latest h2 {
    color: white;
    font-size: 2.1875rem;
    line-height: 2.1875rem;
    margin-block-end: 1.5rem;
  }

  .latest article + p {
    text-align: initial;
  }
}

.trending {
  background-color: white;
  box-shadow: 0 0.125rem 0.75rem 0 rgba(0, 0, 0, 0.08);
  /*margin-block-start: 2.25rem;*/
}

.trending h2 {
  background-color: crimson;
  color: white;
  font-family: neue-haas-unica, sans-serif;
  font-size: 2.1875rem;
  padding-block-end: 0.25rem;
  text-align: center;
}

.trending h3 {
  align-items: center;
  display: flex;
  font-family: neue-haas-unica, sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.75rem;
}

.trending .number {
  align-items: center;
  border: 1px solid crimson;
  border-radius: 50%;
  color: crimson;
  display: flex;
  flex-shrink: 0;
  font-size: 1rem;
  font-weight: 700;
  height: 1.5rem;
  justify-content: center;
  margin-inline-end: 0.75rem;
  width: 1.5rem;
}

.trending .counter::before {
  counter-increment: trending-counter;
  content: counter(trending-counter);
}

.trending li + li {
  /*noinspection CssInvalidFunction*/
  border-block-start: 1px solid hsl(0 0% 80%);
}

footer {
  align-items: center;
  background-color: black;
  display: flex;
  height: 30vh;
  justify-content: center;
}

footer h2 {
  color: white;
  font-family: "Zilla Slab", serif;
  font-size: 2.25rem;
  letter-spacing: 0.1rem;
}

              
            
!

JS

              
                const pageHeader = document.querySelector(".page-header");
window.addEventListener("scroll", (e) => {
  if (window.innerWidth > 959) {
    if (window.scrollY > 50) {
      pageHeader.classList.add("header-collapse");
    }
    if (window.scrollY < 50) {
      pageHeader.classList.remove("header-collapse");
    }
  }
});

              
            
!
999px

Console