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

              
                <h1>SUIT CSS encapsulate with inheritance</h1>
<p>Normal body text</p>

<div class="Component">
  <div class="Component-item">This <code>Component</code> sets properties that are inheritable and the <code>User</code> component opts into some of them with <code>inherit</code></div>
  <div class="Component-item">
    <div class="User">
      <img src="https://placeholdit.imgix.net/~text?txtsize=20&txt=avatar&w=80&h=80" alt="" class="User-img" />
      <div class="User-info">
        <h2 class="User-name">John Doe</h2>
        <p class="User-text">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
        <a class="User-link" href="#">Visit full profile</a>
      </div>
    </div>
  </div>
  <div class="Component-item">
    <div class="User">
      <img src="https://placeholdit.imgix.net/~text?txtsize=20&txt=avatar&w=80&h=80" alt="" class="User-img" />
      <div class="User-info">
        <h2 class="User-name">John Doe</h2>
        <p class="User-text">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
        <a class="User-link" href="#">Visit full profile</a>
      </div>
    </div>
  </div>
  <div class="Component-item">
    <div class="User">
      <img src="https://placeholdit.imgix.net/~text?txtsize=20&txt=avatar&w=80&h=80" alt="" class="User-img" />
      <div class="User-info">
        <h2 class="User-name">John Doe</h2>
        <p class="User-text">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
        <a class="User-link" href="#">Visit full profile</a>
      </div>
    </div>
  </div>
</div>
              
            
!

CSS

              
                body {
  font-size: 1.4em;
  font-family: sans-serif;
  color: purple;
}

/* Added by the preprocessor */
.Component,
.User {
  border-collapse: separate;
  border-spacing: 0;
  caption-side: top;
  color: initial;
  cursor: auto;
  direction: initial;
  empty-cells: show;
  font-size-adjust: none;
  font-family: initial;
  font-size: medium;
  font-style: normal;
  font-stretch: normal;
  font-variant: normal;
  font-weight: normal;
  font: initial;
  letter-spacing: normal;
  line-height: normal;
  list-style-image: none;
  list-style-position: outside;
  list-style-type: disc;
  list-style: initial;
  orphans: 2;
  quotes: initial;
  -moz-tab-size: 8;
    -o-tab-size: 8;
       tab-size: 8;
  text-align: initial;
  -moz-text-align-last: auto;
       text-align-last: auto;
  -webkit-text-decoration-color: initial;
          text-decoration-color: initial;
  text-indent: 0;
  text-justify: auto;
  text-shadow: none;
  text-transform: none;
  visibility: visible;
  white-space: normal;
  widows: 2;
  word-break: normal;
  word-spacing: normal;
  word-wrap: normal;
}

/* Added by the preprocessor */
.Component,
.Component-item,
.User,
.User-info,
.User-text,
.User-img,
.User-link,
.User-name {
  -webkit-animation: none 0s ease 0s 1 normal none running;
          animation: none 0s ease 0s 1 normal none running;
  -webkit-backface-visibility: visible;
          backface-visibility: visible;
  background: transparent none repeat 0 0 / auto auto padding-box border-box scroll;
  border: medium none currentColor;
  -o-border-image: none;
     border-image: none;
  border-radius: 0;
  bottom: auto;
  box-shadow: none;
  clear: none;
  clip: auto;
  -webkit-columns: auto;
     -moz-columns: auto;
          columns: auto;
  -webkit-column-count: auto;
     -moz-column-count: auto;
          column-count: auto;
  -webkit-column-fill: balance;
     -moz-column-fill: balance;
          column-fill: balance;
  -webkit-column-gap: normal;
     -moz-column-gap: normal;
          column-gap: normal;
  -webkit-column-rule: medium none currentColor;
     -moz-column-rule: medium none currentColor;
          column-rule: medium none currentColor;
  -webkit-column-span: 1;
     -moz-column-span: 1;
          column-span: 1;
  -webkit-column-width: auto;
     -moz-column-width: auto;
          column-width: auto;
  content: normal;
  counter-increment: none;
  counter-reset: none;
  float: none;
  height: auto;
  -webkit-hyphens: none;
      -ms-hyphens: none;
          hyphens: none;
  left: auto;
  margin: 0;
  max-height: none;
  max-width: none;
  min-height: 0;
  min-width: 0;
  opacity: 1;
  outline: medium none invert;
  overflow: visible;
  overflow-x: visible;
  overflow-y: visible;
  padding: 0;
  page-break-after: auto;
  page-break-before: auto;
  page-break-inside: auto;
  -webkit-perspective: none;
          perspective: none;
  -webkit-perspective-origin: 50% 50%;
          perspective-origin: 50% 50%;
  position: static;
  right: auto;
  table-layout: auto;
  text-decoration: none;
  top: auto;
  -webkit-transform: none;
          transform: none;
  -webkit-transform-origin: 50% 50% 0;
          transform-origin: 50% 50% 0;
  -webkit-transform-style: flat;
          transform-style: flat;
  -webkit-transition: none 0s ease 0s;
  transition: none 0s ease 0s;
  unicode-bidi: normal;
  vertical-align: baseline;
  width: auto;
  z-index: auto;
}

/* component styles */
.Component {
  /**
   * Component sets some properties that 
   * are usually inherited by children 
   */
  font-family: Helvetica, Arial, sans-serif;
  color: red;
  
  background-color: #444;
  padding: 10px;
}

.Component-item {
  width: 45%;
  margin-bottom: 5px;
}

.User {
  /** 
   * User component opts in to properties 
   * that it wants to inherit from the parent component 
   */
  font-family: inherit;
  color: inherit;
  
  background-color: #eee;
  border: 1px solid #aaa;
  padding: 5px;
  display: flex;
}

.User-name {
  margin-bottom: 5px;
}

.User-text {
  font-style: italic;
  margin-bottom: 3px;
}

.User-link {
  display: block;
}

.User-img {
  border-radius: 4px;
  margin-right: 10px;
}

              
            
!

JS

              
                
              
            
!
999px

Console