Pen Settings



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


Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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


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.


                <nav class="pageNav">
  <div class="pageNav__tabList">
    <div class="pageNav__tabItem pageNav__tabItem--active">1</div>
    <div class="pageNav__tabItem">2</div>
    <div class="pageNav__tabItem">3</div>
  <div class="pageNav__contentList">
    <div class="pageNav__contentItem pageNav__contentItem--active">Первый контент</div>
    <div class="pageNav__contentItem">Второй контент</div>
    <div class="pageNav__contentItem">Третий контент</div>
  <div class="pageNav__priceList">
    <div class="pageNav__priceItem pageNav__priceItem--active">1111111</div>
    <div class="pageNav__priceItem">22222</div>
    <div class="pageNav__priceItem">33333</div>


  width: 500px;
    display: flex;
    justify-content: space-between;
    flex-grow: 1;
    height: 40px;
    background: lightgreen;
    margin: 5px;
    cursor: pointer;
      background: lightblue;
    background: #eee;
    margin: 5px;
    padding: 20px;
    font-size: 24px;
    padding: 20px;
      background: lightblue;

.pageNav__priceItem {
  display: none;

.pageNav__priceItem--active {
  display: block;


const TabItemSelector = '.pageNav__tabItem';
const ContentItemSelector = '.pageNav__contentItem';
const PriceItemSelector = '.pageNav__priceItem';

class TabsManager {
    this.tabs = [];
    this.activeTab = null;


  initFromHtml (navNode) {
    const headers  = navNode.querySelectorAll(TabItemSelector);
    const contents = navNode.querySelectorAll(ContentItemSelector);
    const price = navNode.querySelectorAll(PriceItemSelector);

    for (var i = 0; i < headers.length; i++) {
        this.registerTab(headers[i], contents[i], price[i]);

  registerTab (header, content, price) {
    const tab = new TabItem(header, content, price);
    tab.onActivate(() => this.activateTab(tab));
  activateTab (tabItem) {
    if (this.activeTab) {

    this.activeTab = tabItem;

const ActiveTabHeaderClass = 'pageNav__tabItem--active';
const ActiveTabContentClass = 'pageNav__contentItem--active';
const ActiveTabPriceClass = 'pageNav__priceItem--active';

class TabItem {
    constructor (header, content, price) {
        this.header  = header;
        this.content = content;
        this.price = price;
    onActivate (action) {
        this.header.addEventListener('click', () => action(this));
    setActive(value) {
        this.header.classList.toggle(ActiveTabHeaderClass, value);
        this.content.classList.toggle(ActiveTabContentClass, value);
        this.price.classList.toggle(ActiveTabPriceClass, value);

document.addEventListener('DOMContentLoaded', ()=>{
  let tabs = new TabsManager(document.querySelector('.pageNav'));