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

              
                <body>

  <div class="wrapper">
    <div class="top">
      <header class="hero">
        <h1>Terry's Taco Joint</h1>
        <p>Pretty Good Tacos!</p>
      </header>
      <div class="cta cta1">
        <p class="price">$1.99</p>
        <p>Tacos</p>
      </div>
      <div class="cta cta2">
        <p class="price">$3.99</p>
        <p>Kombucha</p>
      </div>

    </div>
    <nav class="menu">
      <button aria-expanded="false" aria-controls="menu-list">
        <span class="open">☰</span>
        <span class="close">×</span>
        Menu
      </button>
      <ul id="menu-list">
        <li>
          <a href="">Tacos</a>
        </li>
        <li>
          <a href="">Beers</a>
        </li>
        <li>
          <a href="">Wines</a>
        </li>
        <li>
          <a href="">Desserts</a>
        </li>
        <li>
          <a href="">Reservations</a>
        </li>
      </ul>
    </nav>

    <section class="features">
      <div class="feature">
        <span class="icon">🌮</span>
        <h3>Tacos</h3>
        <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Animi, assumenda.</p>
      </div>
      <div class="feature">
        <span class="icon">🍺</span>
        <h3>Beer</h3>
        <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Animi, assumenda.</p>
      </div>
      <div class="feature">
        <span class="icon">🍷</span>
        <h3>Wine</h3>
        <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Animi, assumenda.</p>
      </div>
      <div class="feature">
        <span class="icon">🎵</span>
        <h3>Music</h3>
        <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Animi, assumenda.</p>
      </div>
    </section>

    <section class="about">
      <img src="images/queso-taco.png" alt="Yummy Taco" class="about__mockup">
      <div class="about__details">
        <h2>Featured Taco</h2>
        <p>Slim Profile, easy to hold and loaded with cheese.</p>
        <p>This is the one you have been waiting for</p>
        <button>Learn More →</button>
      </div>
    </section>


    <section class="gallery">
      <h2>Instant Grams</h2>
      <img src="https://source.unsplash.com/random/201x201" alt="">
      <img src="https://source.unsplash.com/random/202x202" alt="">
      <img src="https://source.unsplash.com/random/203x203" alt="">
      <img src="https://source.unsplash.com/random/204x204" alt="">
      <img src="https://source.unsplash.com/random/205x205" alt="">
      <img src="https://source.unsplash.com/random/206x206" alt="">
      <img src="https://source.unsplash.com/random/207x207" alt="">
      <img src="https://source.unsplash.com/random/207x208" alt="">
      <img src="https://source.unsplash.com/random/207x209" alt="">
      <img src="https://source.unsplash.com/random/207x210" alt="">
    </section>
  </div>

</body>


              
            
!

CSS

              
                :root {
  --yellow: #ffc600;
  --black: #272727;
}

body {
  font-size: 15px;
}

button {
  background: #ffc600;
  border: 0;
  padding: 10px 20px;
}

img {
  max-width: 100%;
}

.wrapper {
  display: grid;
  grid-gap: 20px;
}

.top {
  display: grid;
  grid-gap: 20px;
  grid-template-areas:
  "hero hero ct1"
  "hero hero ct2"
}

.hero {
  grid-area: hero;
  min-height: 300px;
  padding: 50px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  border: 2px solid black;
}

.hero>* {
  background: var(--yellow);
  padding: 5px;
}

.cta {
  background: var(--yellow);
  display: grid;
  justify-items: center;
  align-items: center;
  align-content: center;
}

.cta p {
  margin: 0;
}

.ct1 {
  grid-area: ct1;
}

.ct2 {
  grid-area: ct2;
}

.price {
  font-size: 60px;
  font-weight: 300;
}

/* Navigation */

.menu ul {
  display: grid;
  grid-gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  padding: 0;
  margin: 20px 0;
  list-style: none;
}

.menu a {
  background: var(--yellow);
  display: block;
  text-decoration: none;
  padding: 10px;
  text-align: center;
  color: var(--black);
  text-transform: uppercase;
  font-size: 20px;
}

[aria-controls="menu-list"] {
  display: none;
}

.features {
  display: grid;
  grid-gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.feature {
  background: white;
  padding: 10px;
  border: 1px solid white;
  text-align: center;
  box-shadow: 0 0 4px rgba(0, 0, 0, .1)
}

.feature .icon {
  font-size: 20px;
}

.feature p {
  color: rgba(0, 0, 0, .5);
}

/* About Section */

.about {
  background: white;
  padding: 50px;
  display: grid;
  grid-template-columns: 400px 1fr;
  align-items: center;
}

/* Image gallery */

.gallery {
  display: grid;
  grid-gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.gallery h2 {
  display: grid;
  grid-column: 1/-1;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  grid-gap: 20px;
}

.gallery img {
  width: 100%;
}

.gallery h2:before, .gallery h2:after {
  display: block;
  content: '';
  height: 10px;
  background: linear-gradient(to var(--direction, left), var(--yellow),transparent);
}

.gallery h2:after {
  --direction: right;
}

@media (max-width: 1000px) {
  .menu {
    order: -1;
    perspective: 800px;
  }
  [aria-controls="menu-list"] {
    display: block;
    margin-bottom: 10px;
  }
  .menu ul {
    max-height: 0;
    overflow: hidden;
    transform: rotateX(90deg);
    transition: all .5s;
  }
  [aria-expanded="true"] ~ ul {
    max-height: 500px;
    transform: rotateX(0);
  }
  [aria-expanded="false"] .close {
    display: none;
  }
  [aria-expanded="true"] .close {
    display: inline-block;
  }
  [aria-expanded="true"] .open {
    display: none;
  }
}

@media (max-width: 700px) {
  .top {
    grid-template-areas:
    "hero hero"
    "cta1 ct2"
  }

  .about {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 500px) {
  .top {
    grid-template-areas:
    "hero"
    "cta1"
    "ct2"
  }
}
              
            
!

JS

              
                const navBtn = document.querySelector('button[aria-expanded');

function toggleNav({ target }) {
  const expanded = target.getAttribute('aria-expanded') === 'true' || false;
  navBtn.setAttribute('aria-expanded', !expanded);
}

navBtn.addEventListener('click', toggleNav);

              
            
!
999px

Console