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

              
                <h1 class="a-page-title">Scalable teaser components</h1>
<p class="a-page-slug">Only change needed to change the size of the teaser is the <code>font-size</code> on the component wrapper.</p>

  <div class="o-example">
    <p class="o-example__label">No overrides</p>
    <article class="m-teaser">
      <picture class="m-teaser__image-wrapper">
        <!--[if IE 9]><video style="display: none;"><![endif]--><!--[if IE 9]></video><![endif]-->
        <img class="m-teaser__image" srcset="https://www.lullabot.com/sites/default/files/styles/square_120x120/public/2019-02/Chris-white_0.jpeg?itok=s8WvsYoY" 
          alt="" title="">
      </picture>
      <div class="m-teaser__content">
        <footer class="m-teaser__meta">
          <span class="m-teaser__author a-portrait--small">
            by 
            <a class="a-portrait__link" href="#">
                Chris Albrecht
              </a>
            </span>
          </span>
          <time class="m-teaser__publish-date" datetime="2016-04-06">
            April 6, 2016
          </time>
        </footer>
        <h3 class="m-teaser__title">
          <a class="m-teaser__title-link" href="#">
            Welcome to Drupal
          </a>
        </h3>
        <p class="m-teaser__deck">
          Drupal 8 is here! Creating your website with Drupal has never been easier, but where do you start? Learn the basic terminology and get hands-on with this beginners' guide.
        </p>
      </div>
    </article>
  </div>
  <div class="o-example o-example--small">
    <p class="o-example__label">Small Example, 0.75rem</p>
    <article class="m-teaser m-teaser--small">
      <picture class="m-teaser__image-wrapper">
        <!--[if IE 9]><video style="display: none;"><![endif]--><!--[if IE 9]></video><![endif]-->
        <img class="m-teaser__image" srcset="https://www.lullabot.com/sites/default/files/styles/square_120x120/public/2019-02/Chris-white_0.jpeg?itok=s8WvsYoY" 
          alt="" title="">
      </picture>
      <div class="m-teaser__content">
        <footer class="m-teaser__meta">
          <span class="m-teaser__author a-portrait--small">
            by 
            <a class="a-portrait__link" href="#">
                Chris Albrecht
              </a>
            </span>
          </span>
          <time class="m-teaser__publish-date" datetime="2016-04-06">
            April 6, 2016
          </time>
        </footer>
        <h3 class="m-teaser__title">
          <a class="m-teaser__title-link" href="#">
            Welcome to Drupal
          </a>
        </h3>
        <p class="m-teaser__deck">
          Drupal 8 is here! Creating your website with Drupal has never been easier, but where do you start? Learn the basic terminology and get hands-on with this beginners' guide.
        </p>
      </div>
    </article>
  </div>
  <div class="o-example o-example--large">
    <p class="o-example__label">Large Example, 1.5rem</p>
    <article class="m-teaser m-teaser--large">
      <picture class="m-teaser__image-wrapper">
        <!--[if IE 9]><video style="display: none;"><![endif]--><!--[if IE 9]></video><![endif]-->
        <img class="m-teaser__image" srcset="https://www.lullabot.com/sites/default/files/styles/square_120x120/public/2019-02/Chris-white_0.jpeg?itok=s8WvsYoY" 
          alt="" title="">
      </picture>
      <div class="m-teaser__content">
        <footer class="m-teaser__meta">
          <span class="m-teaser__author a-portrait--small">
            by 
            <a class="a-portrait__link" href="#">
                Chris Albrecht
              </a>
            </span>
          </span>
          <time class="m-teaser__publish-date" datetime="2016-04-06">
            April 6, 2016
          </time>
        </footer>
        <h3 class="m-teaser__title">
          <a class="m-teaser__title-link" href="#">
            Welcome to Drupal
          </a>
        </h3>
        <p class="m-teaser__deck">
          Drupal 8 is here! Creating your website with Drupal has never been easier, but where do you start? Learn the basic terminology and get hands-on with this beginners' guide.
        </p>
      </div>
    </article>
  </div>
              
            
!

CSS

              
                ///
// Only code necessary to create differently sized teasers
///
.m-teaser {
  font-size: 1.125rem; // Default
}

.m-teaser--small {
  font-size: 0.875rem;
}

.m-teaser--large {
  font-size: 1.5rem;
}

///
// Teaser styling
///
$f-serif: 'Droid Serif', Georgia,serif;
$f-sans-serif: 'Droid Sans', Arial, sans-serif;

.m-teaser {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  font-family: $f-serif;
  text-align: left;
  max-width: 60em;
  margin-left: auto;
  margin-right: auto;
  @media (min-width: 45em) {
    flex-direction: row;
  }
}

.m-teaser__image-wrapper {
  display: block;
  margin: 0 0 1em;
  @media (min-width: 45em) {
    width: 5.333em;
    min-width: 5.333em;
    margin: 0 2em 0 0;
  }
}

.m-teaser__image {
  display: block;
  border-radius: 50%;
  overflow: hidden;
  @media (min-width: 45em) {
    width: 100%;
  }
}

.m-teaser__meta {
  font-size: 0.8889em;
  margin: 0 0 0.75em;
}

.m-teaser__author,
.m-teaser__publish-date {
  display: block;
  margin: 0 0 0.375em;
  line-height: 1.3;
  @media (min-width: 45em) {
    display: inline-block;
    margin: 0;
  }
}

.m-teaser__author {
  font-style: italic;

  &:after {
    @media (min-width: 45em) {
      content: '//';
      color: #cdebf9;
      margin: 0.9875em;
    }
  }
}

.m-teaser__publish-date {
  font-family: $f-sans-serif;
}

.m-teaser__title {
  margin: 0.179em 0 0.429em;
  font-size: 1.5556em;
  line-height: 1.3;
  font-family: $f-sans-serif;
}

///
// Begin page styles
///
* {
  box-sizing: border-box;
}

body {
  background: #ddd;
  line-height: 1.6;
  @media (min-width: 45em) {
    margin: 2rem;
  }
}

a {
  color: #2284c0;
  text-decoration: none;
  transition: 
    color 0.3s ease,
    background-color 0.3s ease, border 0.3s ease;
  will-change: color, background-color;

  &:hover {
    color: rgb(205, 58, 48);
  }
  
}

.a-page-title {
  margin: 0 0 1rem;
  padding: 0;
  line-height: 1.3;
  font-size: 1.6rem;
  @media (min-width: 45em) {
    font-size: 4.5vw;
  }  
}

.a-page-slug {
  margin: 0 0 1.5rem;
  padding: 0;
  font-size: 1.2rem;
  @media (min-width: 45em) {
    font-size: 1.5rem;
  }
}

.o-examples-list {
  display: flex;
  flex-direction: column;
  align-content: center;
  flex-wrap: wrap;
}

.o-example {
  margin: 0 0 2em;
  padding: 1em 2em 3em;
  font-size: 1rem;
  text-align: center;
  background: #fff;
}

.o-example__label {
  font-weight: bold;
  font-size: 1.25rem;
  border-bottom: 2px solid #ccc;
  padding: 0 0 0.75em;
  margin: 0 0 1.5em;
}

.o-example__item {
  margin: 0 auto;
}


              
            
!

JS

              
                
              
            
!
999px

Console