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

              
                <!DOCTYPE html>
<html lang="ru">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <title>Начал заново</title>
  <link rel="stylesheet" href="css/style.css">
</head>
<body>
  <header class="container header">
    <div>
      [Шапка страницы]
    </div>
  </header>
  <div class="container main">
    <div class="row">
      <div id="col__aside" class="col col__aside">
      	<div class="accordion-item">
        <div class="accordion-item-header">
          Заголовок 1
        </div>
        <div class="accordion-item-content">
          <ul class="accordion-subitems">
            <li class="accordion-subitem">
              <a href="#">Пункт 1.1</a>
            </li>
            <li class="accordion-subitem active">
              <a href="#">Пункт 1.2</a>
            </li>
            <li class="accordion-subitem">
              <a href="#">Пункт 1.3</a>
            </li>
            <li class="accordion-subitem">
              <a href="#">Пункт 1.4</a>
            </li>
            <li class="accordion-subitem">
              <a href="#">Пункт 1.5</a>
            </li>
          </ul>
        </div>
      </div>
      <div class="accordion-item">
        <div class="accordion-item-header">
          Заголовок 2
        </div>
        <div class="accordion-item-content">
          <ul class="accordion-subitems">
            <li class="accordion-subitem">
              <a href="#">Пункт 2.1</a>
            </li>
            <li class="accordion-subitem">
              <a href="#">Пункт 2.2</a>
            </li>
            <li class="accordion-subitem">
              <a href="#">Пункт 2.3</a>
            </li>
            <li class="accordion-subitem">
              <a href="#">Пункт 2.4</a>
            </li>
          </ul>
        </div>
      </div>


         </div>
      <div class="col col__article">
        [Боковая область]
      </div>
    </div>
  </div>
  <footer class="container footer">
  <div class="row">
    <div class="col col__footer">
        Подвал 1
      </div>
    </div>
    <div class="row">
      <div class="col col__footer">
        Подвал 2
      </div>
    </div>
    <div class="row">
      <div class="col col__footer">
        Подвал 3
      </div>
    </div>
  </footer>
  <script src="js/script.js"></script>
</body>
</html>
              
            
!

CSS

              
                /*Обнуление*/
*{
	padding: 0;
	margin: 0;
	border: 0;
}
*,*:before,*:after{
	-moz-box-sizing: border-box;
	-webkit-box-sizing: border-box;
	box-sizing: border-box;
}
:focus,:active{outline: none;}
a:focus,a:active{outline: none;}

nav,footer,header,aside{display: block;}

html,body{
	height: 100%;
	width: 100%;
	font-size: 100%;
	line-height: 1;
	font-size: 14px;
	-ms-text-size-adjust: 100%;
	-moz-text-size-adjust: 100%;
	-webkit-text-size-adjust: 100%;
	display: flex;
  flex-direction: column;
}
input,button,textarea{font-family:inherit;}

input::-ms-clear{display: none;}
button{cursor: pointer;}
button::-moz-focus-inner {padding:0;border:0;}
a, a:visited{text-decoration: none;}
a:hover{text-decoration: none;}
ul li{list-style: none;}
img{vertical-align: top;}

h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight: 400;}
/*-----------------------------------------------------*/
/* контейнер */
    .container {
      width: 100%;
      max-width: 1200px;
      padding-right: 15px;
      padding-left: 15px;
      margin-left: auto;
      margin-right: auto;
    }
    /* flex-контейнер */
    .row {
      display: -ms-flexbox;
      display: flex;
      -ms-flex-wrap: wrap;
      flex-wrap: wrap;
      margin-right: -15px;
      margin-left: -15px;
      /*border: 5px solid red;*/
    }
    /* CSS настройки flex-элементов */
    .col {
      position: relative;
      width: 100%;
      padding-right: 15px;
      padding-left: 15px;
    }
    /* ширина блоков article и aside по умолчанию */
    .col__article,
    .col__aside {
      -ms-flex: 0 0 100%;
      flex: 0 0 100%;
      max-width: 100%;
    }
    /* ширина блоков article и aside для больших экранов */
    @media (min-width: 992px) {
      /* 2/3 от ширины контейнера */
      .col__article {
        -ms-flex: 0 0 66.666667%;
        flex: 0 0 66.666667%;
        max-width: 66.666667%;
      }
      /* 1/3 от ширины контейнера */
      .col__aside {
        -ms-flex: 0 0 33.333333%;
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
      }
    }
    .header {
      background-color: #2F4F4F;
      flex: 0 0 auto;
      font-size: 20px;
      text-align: center;
      padding-top: 20px;
      padding-bottom: 20px;
    }
    .col__article {
      background-color: #fff8e1;
      font-size: 20px;
      text-align:center;
      padding-top: 30px;
      padding-bottom: 30px;
    }
    .col__aside {
      background-color: #dcedc8;
      font-size: 20px;
      text-align:center;
      padding-top: 20px;
      padding-bottom: 20px;
      /*min-height: 200px;*/  /*Узнать нужно ли?*/
    }
    .main {
      flex: 1 0 auto;
      display: flex;
    }
    .main .row {
      flex-grow: 1;
    }
    .footer {
      flex: 0 0 auto;
      display: flex;
      background: #2F4F4F;
      justify-content: space-between;
    }
    .col__footer {
    -ms-flex: 1 0 0;
    flex: 1 0 0;
    padding-top: 20px;
    padding-bottom: 20px;
    font-size: 20px;
    text-align:center;
    }
  /*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/
  .accordion-item {
      margin-bottom: 1px;
    }

    .accordion-item:last-child {
      margin-bottom: 0;
    }

    .accordion-item-header {
      padding: 10px 10px 10px 20px;
      background: #4d5159;
      color: rgba(255, 255, 255, .8);
      cursor: pointer;
      text-transform: uppercase;
      font-family: sans-serif;
      position: relative;
    }

    .accordion-item.show .accordion-item-header,
    .accordion-item-header:hover,
    .accordion-item-header:focus {
      background: #3b3e44;
    }

    .accordion-item-header::before {
      content: "";
      position: absolute;
      top: 0;
      left: 0;
      bottom: 0;
      width: 10px;
      background: rgba(255, 255, 255, .5);
    }

    .accordion-item-header::after {
      content: "";
      position: absolute;
      top: 50%;
      right: 12px;
      width: 16px;
      height: 16px;
      margin-top: -8px;
      background-size: cover;
    }

    .accordion-item-content {
      display: none;
    }

    .accordion-item.show .accordion-item-content {
      display: block;
    }

    .accordion-item.show .accordion-item-header::after {
      transform: rotate(180deg);
    }


    .accordion-subitems {
      list-style-type: none;
      margin: 0;
      padding: 0;
    }

    .accordion-subitem>a {
      padding: 10px 10px 10px 20px;
      background: #ebeaec;
      color: #333;
      cursor: pointer;
      text-transform: uppercase;
      font-family: sans-serif;
      position: relative;
      margin-top: 1px;
      display: block;
      text-decoration: none;
    }

    .accordion-subitem>a::before {
      content: "";
      position: absolute;
      top: 0;
      left: 0;
      bottom: 0;
      width: 10px;
      background: rgba(255, 255, 255, .5);
    }
    .accordion-subitem a:hover,
    .accordion-subitem a:focus {
      background: #d4d3d5;
    }

   
              
            
!

JS

              
                 var col__aside = (function (element) {

      var _getItem = function (elements, className) { // функция для получения элемента с указанным классом
        var element = undefined;
        elements.forEach(function (item) {
          if (item.classList.contains(className)) {
            element = item;
          }
        });
        return element;
      };

      return function () {
        var _mainElement = {}, // .accordion
          _items = {}, // .accordion-item
          _contents = {}; // .accordion-item-content

        var _actionClick = function (e) {
          if (!e.target.classList.contains('accordion-item-header')) { // прекращаем выполнение функции если кликнули не по заголовку
            return;
          }
          e.preventDefault();   // Отменям стандартное действие
          // получаем необходимые данные
          var header = e.target,
            item = header.parentElement,
            itemActive = _getItem(_items, 'show');

          if (itemActive === undefined) { // добавляем класс show к элементу (в зависимости от выбранного заголовка)
            item.classList.add('show');
          } else {
            // удаляем класс show у ткущего элемента
            itemActive.classList.remove('show');
            // если следующая вкладка не равна активной
            if (itemActive !== item) {
              // добавляем класс show к элементу (в зависимости от выбранного заголовка)
              item.classList.add('show');
            }
          }
        },
          _setupListeners = function () {
            // добавим к элементу аккордиона обработчик события click
            _mainElement.addEventListener('click', _actionClick);
          };

        return {
          init: function (element) {
            _mainElement = (typeof element === 'string' ? document.querySelector(element) : element);
            _items = _mainElement.querySelectorAll('.accordion-item');
            _setupListeners();
          }
        }

      }
    })();

    var col__aside1 = col__aside();
    col__aside1.init('#col__aside');
              
            
!
999px

Console