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 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


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.


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.


                  <ul id="booksHolder">
    <li data-magic="0" data-humor="0" data-detective="0" data-afraid="0">Л.Н. Толстой. Война и мир</li>
    <li data-magic="1" data-humor="0" data-detective="0" data-afraid="0">Джоан Роулинг.Гарри Поттер</li>
    <li data-magic="1" data-humor="1" data-detective="0" data-afraid="0">Братья Стругацкие. Понедельник начинается в субботу.</li>
    <li data-magic="1" data-humor="1" data-detective="1" data-afraid="0">Агата Кристи. Вечеринка в Хэллоуин.</li>
    <li data-magic="1" data-humor="1" data-detective="1" data-afraid="1">Джонатан Страуд. Кричащая лестница.</li>
    <li data-magic="1" data-humor="0" data-detective="1" data-afraid="0">Диана Маш. Заноза для драконьего военачальника.</li>
    <li data-magic="0" data-humor="1" data-detective="0" data-afraid="1">Кирилл Круганский. Смешно или страшно.</li>
    <li data-magic="0" data-humor="0" data-detective="0" data-afraid="1">Стивен Кинг. Мизери.</li>
    <li data-magic="0" data-humor="0" data-detective="1" data-afraid="1">Эдгар По. Очень страшные истории.</li>
    <li data-magic="0" data-humor="0" data-detective="1" data-afraid="0">А. Маринина. Безупречная репутация</li>
  <p id="info" hidden>
    К сожалению, мы ничего вам не можем предложить на данный момент.
    <label><input type="checkbox" name="chooseBook" value="magic">Про волшебство должно быть?</label>
    <label><input type="checkbox" name="chooseBook" value="humor">Надо, чтобы было смешно?</label>
    <label><input type="checkbox" name="chooseBook" value="detective">Детективная история нужна?</label>
    <label><input type="checkbox" name="chooseBook" value="afraid">Бояться будете?</label>
    <button type="button" id="chooseBtn">Выбор сделан</button>


                body {
  margin: 30px 10%;
  font-family: sans-serif;
  font-size: 18px;
button {
  display: block;
  width: 150px;
  margin-top: 15px;
  padding: 10px;
  background-color: #cde;
  color: #5eb4d9;
  border: 2px solid #5eb4d9;
button:hover, button:focus {
  background-color: #5eb4d9;
  color: #fff;
label {
  display: block;
  margin-bottom: 15px;
label input {
  display: inline-block;
  vertical-align: top;
  margin-right: 12px;
#info {
  background-color: #cde;
  padding: 15px;
  border: 3px solid #1e8cbe;
  color: #1e8cbe;


                let checkboxes = document.getElementsByName("chooseBook"), booksLi = document.querySelectorAll("#booksHolder li"), answers = {};
chooseBtn.onclick = function () {
  let bookCount = 0;
  for (let one of checkboxes) {
    if (one.checked) answers[one.value] = 1;
    else answers[one.value] = 0;
  booksLi.forEach((book, index) => {
    if (answers.magic == book.dataset.magic && answers.humor == book.dataset.humor && answers.detective == book.dataset.detective && answers.afraid == book.dataset.afraid) { = "red";
    else { = ""; }
  info.hidden = bookCount;