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

              
                <div class="container my-sm-4 p-4">
  <div class="row">
    <div class="market-basket col-sm card align-self-center py-4">
      <div class="d-flex justify-content-around">
        <div class="basket-item fruit-apple">🍏</div>
        <div class="fruit-strawberry basket-item">🍓</div>
        <div class="basket-item fruit-lemon">🍋</div>
      </div>
      <div class="vegetable-container d-flex justify-content-around mt-4">
        <div class="vegetable-carrot basket-item">🥕</div>
        <div class="basket-item vegetable-potato">🥔</div>
        <div class="vegetable-brocoli basket-item">🥦</div>
        <div class="basket-item vegetable-onion">🧅</div>
      </div>
    </div>
    <div class="basket-count col-sm ml-2 p-3">
      <h3>Your basket contains:</h3>
      <p class="fruits-count"></p>
      <p class="vegetables-count"></p>
    </div>
  </div>
</div>
              
            
!

CSS

              
                div.basket-item {
  font-size: 30px;
}

.market-basket {
  background-color: #bde3cd;
}

.basket-count {
  background-color: #fafafa;
}
              
            
!

JS

              
                const badgeOk = '<span class="badge badge-success ml-2">OK</span>';
const badgeKo = '<span class="badge badge-danger ml-2">KO</span>';

var fruitCount = $('[class^="fruit-"]').length;
$('.fruits-count').html(fruitCount  + " fruits " + badgeKo);
//$('.fruits-count').append('<span class="badge badge-light ml-2">Using ^ selector</span>');
  
var veggieCount = $('[class*="vegetable-"]').length;
$('.vegetables-count').html(veggieCount  + " vegetables " + badgeOk);
//$('.vegetables-count').append('<span class="badge badge-light ml-2">Using * selector</span>');
              
            
!
999px

Console