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

              
                <html>
 <head>
  <meta charset="utf-8">
  <title>details</title>
        <script>
            /*yepnope1.0.2|WTFPL*/
            (function(a,b,c){function H(){var a=z;a.loader={load:G,i:0};return a}function G(a,b,c){var e=b=="c"?r:q;i=0,b=b||"j",u(a)?F(e,a,b,this.i++,d,c):(h.splice(this.i++,0,a),h.length==1&&E());return this}function F(a,c,d,g,j,l){function q(){!o&&A(n.readyState)&&(p.r=o=1,!i&&B(),n.onload=n.onreadystatechange=null,e(function(){m.removeChild(n)},0))}var n=b.createElement(a),o=0,p={t:d,s:c,e:l};n.src=n.data=c,!k&&(n.style.display="none"),n.width=n.height="0",a!="object"&&(n.type=d),n.onload=n.onreadystatechange=q,a=="img"?n.onerror=q:a=="script"&&(n.onerror=function(){p.e=p.r=1,E()}),h.splice(g,0,p),m.insertBefore(n,k?null:f),e(function(){o||(m.removeChild(n),p.r=p.e=o=1,B())},z.errorTimeout)}function E(){var a=h.shift();i=1,a?a.t?e(function(){a.t=="c"?D(a):C(a)},0):(a(),B()):i=0}function D(a){var c=b.createElement("link"),d;c.href=a.s,c.rel="stylesheet",c.type="text/css";if(!a.e&&(o||j)){var g=function(a){e(function(){if(!d)try{a.sheet.cssRules.length?(d=1,B()):g(a)}catch(b){b.code==1e3||b.message=="security"||b.message=="denied"?(d=1,e(function(){B()},0)):g(a)}},0)};g(c)}else c.onload=function(){d||(d=1,e(function(){B()},0))},a.e&&c.onload();e(function(){d||(d=1,B())},z.errorTimeout),!a.e&&f.parentNode.insertBefore(c,f)}function C(a){var c=b.createElement("script"),d;c.src=a.s,c.onreadystatechange=c.onload=function(){!d&&A(c.readyState)&&(d=1,B(),c.onload=c.onreadystatechange=null)},e(function(){d||(d=1,B())},z.errorTimeout),a.e?c.onload():f.parentNode.insertBefore(c,f)}function B(){var a=1,b=-1;while(h.length- ++b)if(h[b].s&&!(a=h[b].r))break;a&&E()}function A(a){return!a||a=="loaded"||a=="complete"}var d=b.documentElement,e=a.setTimeout,f=b.getElementsByTagName("script")[0],g={}.toString,h=[],i=0,j="MozAppearance"in d.style,k=j&&!!b.createRange().compareNode,l=j&&!k,m=k?d:f.parentNode,n=a.opera&&g.call(a.opera)=="[object Opera]",o="webkitAppearance"in d.style,p=o&&"async"in b.createElement("script"),q=j?"object":n||p?"img":"script",r=o?"img":q,s=Array.isArray||function(a){return g.call(a)=="[object Array]"},t=function(a){return Object(a)===a},u=function(a){return typeof a=="string"},v=function(a){return g.call(a)=="[object Function]"},w=[],x={},y,z;z=function(a){function h(a,b){function i(a){if(u(a))g(a,f,b,0,c);else if(t(a))for(h in a)a.hasOwnProperty(h)&&g(a[h],f,b,h,c)}var c=!!a.test,d=c?a.yep:a.nope,e=a.load||a.both,f=a.callback,h;i(d),i(e),a.complete&&b.load(a.complete)}function g(a,b,d,e,g){var h=f(a),i=h.autoCallback;if(!h.bypass){b&&(b=v(b)?b:b[a]||b[e]||b[a.split("/").pop().split("?")[0]]);if(h.instead)return h.instead(a,b,d,e,g);d.load(h.url,h.forceCSS||!h.forceJS&&/css$/.test(h.url)?"c":c,h.noexec),(v(b)||v(i))&&d.load(function(){H(),b&&b(h.origUrl,g,e),i&&i(h.origUrl,g,e)})}}function f(a){var b=a.split("!"),c=w.length,d=b.pop(),e=b.length,f={url:d,origUrl:d,prefixes:b},g,h;for(h=0;h<e;h++)g=x[b[h]],g&&(f=g(f));for(h=0;h<c;h++)f=w[h](f);return f}var b,d,e=this.yepnope.loader;if(u(a))g(a,0,e,0);else if(s(a))for(b=0;b<a.length;b++)d=a[b],u(d)?g(d,0,e,0):s(d)?z(d):t(d)&&h(d,e);else t(a)&&h(a,e)},z.addPrefix=function(a,b){x[a]=b},z.addFilter=function(a){w.push(a)},z.errorTimeout=1e4,b.readyState==null&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",y=function(){b.removeEventListener("DOMContentLoaded",y,0),b.readyState="complete"},0)),a.yepnope=H()})(this,this.document)

        </script>

        <script >
            var Supports = {
                details: ('open' in document.createElement('details'))
            };
            yepnope({
                test: Supports.details,
                nope: 'js/details.polyfill.js'
            });
        </script>

 </head> 

<body>

Тема 1: Стихийные бедствия.
Автор: Булат Фаттахов
10. Таким женским именем звали ураган, сильно повредивший Новый Орлеан.
<details><summary>Ответ:</summary>Катрина.</details>
20. "Дождь лил четыре года, одиннадцать месяцев и два дня" именно там.
<details><summary>Ответ:</summary>в Макондо.</details>
30. В 1883 году было извержение вулкана именно на этом острове.
<details><summary>Ответ:</summary>Кракатау (Остров назывался так же как и вулкан).</details>
40. Армянские города Гюмри и Ванадзор, сильно пострадавшие во время землетрясения 1988 года, в советское время носили такие названия.
<details><summary>Ответ:</summary>Ленинакан и Кировокан.</details>
50. Крупнейшее за всю историю человечества это стихийное бедствие произошло в 1875 году в США, а не в Египте двумя тысячами годами ранее.
<details><summary>Ответ:</summary>Нашествие саранчи.</details>

Тема 2: Города России.
Автор: Булат Фаттахов
10. Это крупнейший город России после Москвы.
<details><summary>Ответ:</summary>Санкт-Петербург.</details>
20. Москва крупнейший город России, а Тольятти тоже крупнейший город в России среди таких.
<details><summary>Ответ:</summary>Не являющийся столицей региона.</details>
30. Это - крупнейший город самого большого острова России.
<details><summary>Ответ:</summary>Южно-Сахалинск.</details>
40. Именно в этом городе происходит действие сериала "Счастливы вместе".
<details><summary>Ответ:</summary>Екатеринбург.</details>
50. А именно этот город является самым западным городом России.
<details><summary>Ответ:</summary>Балтийск.</details>

</body> 
</html>
              
            
!

CSS

              
                

              
            
!

JS

              
                
/* Licensed under the MIT license: https://www.opensource.org/licenses/mit-license.php */
(function (doc) {
'use strict';
var i, j,
textWrapper,
idCount = 0,
rootNode = doc.documentElement,
headElem = doc.getElementsByTagName('head')[0] || rootNode,
bodyElem = doc.getElementsByTagName('body')[0] || rootNode,
detailStyleTag = doc.createElement('style'),
rules = 'details { display: block; overflow:hidden; } \n' +
'details[open] { height: auto; } \n' +
'summary { display:inline-block; } \n' +
'details * { visibility: hidden; } \n' +
'summary:first-child { visibility: visible; cursor: pointer; } \n' +
'details[open] * { visibility: visible } \n' +
'details[open] summary { margin-bottom: 0; }',
/* Technically, a summary element has a "Phrasing content" model and should be displayed inline.
* see http://dev.w3.org/html5/spec/Overview.html#the-summary-element,
* http://dev.w3.org/html5/spec/Overview.html#phrasing-content
*
* FYI: Chrome currently and incorrectly treats the <summary> element as block level.
*/
addRule = function (styleTag, rule) {
if (styleTag.nodeName.toLowerCase() === 'style') {
if (!!styleTag['styleSheet'] && styleTag.styleSheet['cssText'] !== undefined) { //for MSIE
styleTag.styleSheet.cssText += '\n' + rule;
} else { styleTag.appendChild(doc.createTextNode('\n' + rule)); }
}
},
addEvent = function (el, eventName, f) {
//W3C event biding
if (el.addEventListener) {
el.addEventListener(eventName, f);
//IE event binding
} else if (el.attachEvent) {
el.attachEvent('on' + eventName, f);
// Fallback, but don't overwrite a preexisting "onclick" attribute.
} else if (el['on' + eventName] === null) {
el['on' + eventName] = f;
}
},
toggle = function (e) {
/* When a <summary> element is clicked the parent <details> element's "open"
* attribute needs to be toggled to maintain the attribute's reflective nature.
* see http://dev.w3.org/html5/spec/Overview.html#attr-details-open
*/
var detailsElmnt,
target = e.target || e.srcElement;
if (target.nodeName.toLowerCase() === 'summary') {
detailsElmnt = target;
while (detailsElmnt.nodeName.toLowerCase() !== 'details') {
detailsElmnt = detailsElmnt.parentNode;
//Break if we get to the root node without finding a details element.
if (detailsElmnt === bodyElem) {
detailsElmnt = null;
break;
}
}
if (detailsElmnt) {
if (detailsElmnt.getAttribute('open')) {
detailsElmnt.removeAttribute('open');
} else { detailsElmnt.setAttribute('open', 'open'); }
bodyElem.className = bodyElem.className;
}
}
},
init = function () {
var detailsID,
detailsElem,
summaryElem,
height, //height of the summary element
detailsElems = doc.getElementsByTagName('details');
for (i = 0; i < detailsElems.length; i++) {
detailsElem = detailsElems[i];
if (!detailsElem.getAttribute('data-detailsid')) {
detailsID = 'd' + (idCount++);
detailsElem.className += (' ' + detailsID);
detailsElem.setAttribute('data-detailsID', detailsID);
/* The spec expects the functional <summary> element to be the first child node of a
* <details> element. In practice, it appears the first child <summary> element of a
* <detials> element is enlisted as the functional <summary> element and displayed as
* though it were the first child. For our purposes, we will do that explicitly.
* Additionaly, If a <summary> element does not exist, a default toggle is provided.
*/
summaryElem = detailsElem.getElementsByTagName('summary')[0];
if (!summaryElem) {
summaryElem = doc.createElement('summary');
summaryElem.appendChild(doc.createTextNode('Details'));
detailsElem.insertBefore(summaryElem, detailsElem.firstChild);
} else if ( summaryElem !== detailsElem.firstChild) {
detailsElem.removeChild(summaryElem);
detailsElem.insertBefore(summaryElem, detailsElem.firstChild);
}
height = summaryElem.offsetHeight;
addRule(detailStyleTag, 'details.' + detailsID + ' { height: ' + height + 'px; }\n' +
'details.' + detailsID + '[open] { height: auto; }');
//Text nodes are killing me here. Thanks to @Remy for the solve.
// Weighing the pros and cons of using a standard element like <span> or <b> vs a non-standard
// but more semantically meaninfull <text> element, I think <text> wins, though not without some
// regret.
for (j = 0; j < detailsElem.childNodes.length; j++ ) {
if (detailsElem.childNodes[j].nodeName === '#text' && (detailsElem.childNodes[j].nodeValue||'').replace(/\s/g, '').length) {
textWrapper = document.createElement('text');
textWrapper.appendChild(detailsElem.childNodes[j]);
detailsElem.insertBefore(textWrapper, detailsElem.childNodes[j]);
}
}
}
}
};
/*
* The inserted stylesheet needs to be first so as to have a minimal cascading coeffecient.
* It also needs to be added to the DOM before IE can access it's properties.
* The polyfill only adds default or necessary styling and should not interfere with other style rules.
*/
headElem.insertBefore(detailStyleTag, headElem.firstChild);
init();
addRule(detailStyleTag, rules);
addEvent(bodyElem, 'click', toggle);
addEvent(bodyElem, 'DOMSubtreeModified', init);
}(document, undefined));
              
            
!
999px

Console