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 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="bg-yellow-100 p-2">
  <h1>VeryGoodBlog.com</h1>
</header>

<div class="banner">
  <div class="container">
    <h2>Consent Notice</h2>
    <p>To gather information on how people use our websites, we use cookies, including third-party cookies. They help us to provide you with the best experience possible, to constantly develop our sites and to provide you with deals tailored to your interests. You consent to the use of these cookies by clicking the "Accept all" button. At any moment, you may withdraw your permission, or alter your preferences.</p>
    <button>Accept Cookies</button>
  </div>
</div>

<div class="hero">
  <img src="https://source.unsplash.com/random/2000x600" alt="image to load in">
  <small class="text-right block">A 2000x600 image</small>
</div>

<article class="max-w-2xl mx-auto">
  <h1 class="text-5xl font-light my-5">Very Interesting Article</h1>
  <p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Pariatur aut recusandae placeat, numquam ratione totam quisquam necessitatibus, ipsa nostrum dolorem veritatis, modi accusamus iste exercitationem atque molestias porro laudantium tempore?</p>

<figure class="bg-gray-200 p-3 text-center">
  <img src="https://source.unsplash.com/random/800x600" alt="image to load in">
  <figcaption>An 800x600 image will load in
  </figcaption>
</figure>

  <p> Ipsum ullam, dolore dolores facere commodi dolor tempora ipsa nobis obcaecati voluptas hic reprehenderit consequuntur autem quod voluptatem voluptate quidem sequi. Voluptatum consequuntur qui architecto, inventore minima vitae possimus quia.</p>

  <p>Optio laudantium eum deserunt dolore quidem, minus impedit magni provident facilis, eveniet quas numquam laborum doloremque, aperiam harum. Dolor architecto vitae temporibus deserunt, laudantium eius. Iusto debitis iste quidem nesciunt!</p>

  <p>Ad placeat consectetur veritatis sed. Iure enim excepturi dolore voluptatum error temporibus magni optio mollitia, dolorem necessitatibus? Odit corrupti non illum laboriosam fugit! Veniam consectetur optio illo iusto dicta repudiandae!</p>

  <p>Magni, pariatur dignissimos similique voluptatum earum quia dolorem eos, facilis voluptas, omnis ex debitis autem illum esse a delectus laboriosam velit nam ipsum est ut. Molestias itaque porro modi repudiandae.</p>

  <p>Perferendis, consequuntur totam! Aspernatur nam ullam ipsum dicta saepe omnis adipisci magni nesciunt, ab numquam placeat voluptates. Aliquam tempora deserunt dolores adipisci ratione aperiam, vero quod officiis rerum est a?</p>

  <p>Ipsum accusamus accusantium ex laborum. Quod delectus, aperiam eveniet quis aliquid molestiae quae quidem minus! Quaerat iusto velit doloremque vitae quo modi quam blanditiis. Blanditiis quibusdam velit nulla veniam perferendis.</p>

  <p>Dolorum, minima perspiciatis autem qui unde repellendus laboriosam. Adipisci ducimus nisi tenetur, atque voluptates magnam obcaecati dolor maxime blanditiis expedita fuga tempore enim vitae minus excepturi quos, dolorem quis esse?</p>
</article>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900');

body {
  line-height: 2;
  font-family: 'Roboto';
}

h1, h2, h3 {
  font-family: 'Montserrat';
}

img {
  width: 100%;
}

p {
  margin: 1rem 0;
}

h2 {
  font-size: 1.5rem;
  font-weight: bold;
}

.banner {
  padding: 1rem;
  background: aliceblue;
  display: none;
  position: sticky;
  width: 100%;
  top: 0;
  background: url('https://cdn.pixabay.com/photo/2015/07/15/06/14/gradient-845701_960_720.jpg');
  background-size: cover;
}

.banner button {
  font-size: 1.2rem;
  background: #222;
  color: white;
  padding: 0.25rem 0.5rem;
}

.banner button {
  align-self: flex-end;
}

.banner .container {
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

// animating in blog header 

header h1 {
  animation: slideIn 1s 1 ease;
}

@keyframes slideIn {
  from {
    margin-left: -100%;
  }
  to {
    margin-left: 0;
  }
}
              
            
!

JS

              
                const checkCookieAccept = () => { document.querySelector('.banner').style.display = 'block';
}

// Immitates server trip to check cookie acceptance
setTimeout(checkCookieAccept(), 1200)

// Gradient background from:
// https://pixabay.com/illustrations/gradient-pale-pastels-smooth-soft-845701/
              
            
!
999px

Console