{"id":1148,"date":"2023-04-02T14:58:00","date_gmt":"2023-04-02T11:58:00","guid":{"rendered":"https:\/\/notes.profidev.online\/?p=1148"},"modified":"2023-04-02T09:01:15","modified_gmt":"2023-04-02T06:01:15","slug":"pure-css-accordion-2","status":"publish","type":"post","link":"https:\/\/notes.profidev.online\/ru\/accordion\/1148\/","title":{"rendered":"Pure CSS Accordion"},"content":{"rendered":"\n<figure class=\"wp-block-video\"><video height=\"593\" style=\"aspect-ratio: 1204 \/ 593;\" width=\"1204\" controls src=\"https:\/\/notes.profidev.online\/wp-content\/uploads\/2023\/04\/vokoscreenng-2023-04-02_07-58-28.webm\"><\/video><\/figure>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;htmlmixed&quot;,&quot;mime&quot;:&quot;text\/html&quot;,&quot;theme&quot;:&quot;cobalt&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:true,&quot;readOnly&quot;:false,&quot;fileName&quot;:&quot;&quot;,&quot;TrpContentRestriction&quot;:{&quot;restriction_type&quot;:&quot;exclude&quot;,&quot;selected_languages&quot;:[],&quot;panel_open&quot;:true},&quot;language&quot;:&quot;HTML&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;html&quot;}\">  &lt;h1&gt;CSS + HTML only Accordion Element&lt;\/h1&gt;\n  &lt;ul&gt;\n    &lt;li&gt;\n      &lt;input type=&quot;checkbox&quot; checked&gt;\n      &lt;i&gt;&lt;\/i&gt;\n      &lt;h2&gt;Languages Used&lt;\/h2&gt;\n      &lt;p&gt;This page was written in HTML and CSS. &lt;\/p&gt;\n    &lt;\/li&gt;\n    &lt;li&gt;\n      &lt;input type=&quot;checkbox&quot; checked&gt;\n      &lt;i&gt;&lt;\/i&gt;\n      &lt;h2&gt;How it Works&lt;\/h2&gt;\n      &lt;p&gt;Using the sibling and checked selectors&lt;\/p&gt;\n    &lt;\/li&gt;\n    &lt;li&gt;\n      &lt;input type=&quot;checkbox&quot; checked&gt;\n      &lt;i&gt;&lt;\/i&gt;\n      &lt;h2&gt;Points of Interest&lt;\/h2&gt;\n      &lt;p&gt;By making the open state default for when :checked isn't detected&lt;\/p&gt;\n    &lt;\/li&gt;\n  &lt;\/ul&gt;<\/pre><\/div>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;css&quot;,&quot;mime&quot;:&quot;text\/css&quot;,&quot;theme&quot;:&quot;cobalt&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:true,&quot;readOnly&quot;:false,&quot;fileName&quot;:&quot;&quot;,&quot;TrpContentRestriction&quot;:{&quot;restriction_type&quot;:&quot;exclude&quot;,&quot;selected_languages&quot;:[],&quot;panel_open&quot;:true},&quot;language&quot;:&quot;CSS&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;css&quot;}\">.transition, ul li i:before, ul li i:after, p {\n  transition: all 0.25s ease-in-out;\n}\n\n.flipIn, ul li, h1 {\n  animation: flipdown 0.5s ease both;\n}\n\n.no-select, h2 {\n  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n  -webkit-touch-callout: none;\n  -webkit-user-select: none;\n  -khtml-user-select: none;\n  -moz-user-select: none;\n  -ms-user-select: none;\n  user-select: none;\n}\n\nhtml {\n  width: 100%;\n  height: 100%;\n  perspective: 900;\n  overflow-y: scroll;\n  background-color: #dce7eb;\n  font-family: &quot;Titillium Web&quot;, sans-serif;\n  color: rgba(48, 69, 92, 0.8);\n}\n\nbody {\n  min-height: 0;\n  display: inline-block;\n  position: relative;\n  left: 50%;\n  margin: 90px 0;\n  transform: translate(-50%, 0);\n  box-shadow: 0 10px 0 0 #003999 inset;\n  background-color: #fefffa;\n  max-width: 840px;\n  padding: 30px;\n}\n@media (max-width: 550px) {\n  body {\n    box-sizing: border-box;\n    transform: translate(0, 0);\n    max-width: 100%;\n    min-height: 100%;\n    margin: 0;\n    left: 0;\n  }\n}\n\nh1, h2 {\n  color: #003999;\n}\n\nh1 {\n  text-transform: uppercase;\n  font-size: 36px;\n  line-height: 42px;\n  letter-spacing: 3px;\n  font-weight: 100;\n}\n\nh2 {\n  font-size: 26px;\n  line-height: 34px;\n  font-weight: 300;\n  letter-spacing: 1px;\n  display: block;\n  background-color: #fefffa;\n  margin: 0;\n  cursor: pointer;\n}\n\np {\n  color: rgba(48, 69, 92, 0.8);\n  font-size: 17px;\n  line-height: 26px;\n  letter-spacing: 1px;\n  position: relative;\n  overflow: hidden;\n  max-height: 800px;\n  opacity: 1;\n  transform: translate(0, 0);\n  margin-top: 14px;\n  z-index: 2;\n}\n\nul {\n  list-style: none;\n  perspective: 900;\n  padding: 0;\n  margin: 0;\n}\nul li {\n  position: relative;\n  padding: 0;\n  margin: 0;\n  padding-bottom: 4px;\n  padding-top: 18px;\n  border-top: 1px dotted #dce7eb;\n}\nul li:nth-of-type(1) {\n  animation-delay: 0.5s;\n}\nul li:nth-of-type(2) {\n  animation-delay: 0.75s;\n}\nul li:nth-of-type(3) {\n  animation-delay: 1s;\n}\nul li:last-of-type {\n  padding-bottom: 0;\n}\nul li i {\n  position: absolute;\n  transform: translate(-6px, 0);\n  margin-top: 16px;\n  right: 0;\n}\nul li i:before, ul li i:after {\n  content: &quot;&quot;;\n  position: absolute;\n  background-color: #003999;\n  width: 3px;\n  height: 9px;\n}\nul li i:before {\n  transform: translate(-2px, 0) rotate(45deg);\n}\nul li i:after {\n  transform: translate(2px, 0) rotate(-45deg);\n}\nul li input[type=checkbox] {\n  position: absolute;\n  cursor: pointer;\n  width: 100%;\n  height: 100%;\n  z-index: 1;\n  opacity: 0;\n}\nul li input[type=checkbox]:checked ~ p {\n  margin-top: 0;\n  max-height: 0;\n  opacity: 0;\n  transform: translate(0, 50%);\n}\nul li input[type=checkbox]:checked ~ i:before {\n  transform: translate(2px, 0) rotate(45deg);\n}\nul li input[type=checkbox]:checked ~ i:after {\n  transform: translate(-2px, 0) rotate(-45deg);\n}\n\n@keyframes flipdown {\n  0% {\n    opacity: 0;\n    transform-origin: top center;\n    transform: rotateX(-90deg);\n  }\n  5% {\n    opacity: 1;\n  }\n  80% {\n    transform: rotateX(8deg);\n  }\n  83% {\n    transform: rotateX(6deg);\n  }\n  92% {\n    transform: rotateX(-3deg);\n  }\n  100% {\n    transform-origin: top center;\n    transform: rotateX(0deg);\n  }\n}<\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":1149,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[61],"tags":[16],"class_list":["post-1148","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-accordion","tag-htmlcss"],"_links":{"self":[{"href":"https:\/\/notes.profidev.online\/ru\/wp-json\/wp\/v2\/posts\/1148","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/notes.profidev.online\/ru\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/notes.profidev.online\/ru\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/notes.profidev.online\/ru\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/notes.profidev.online\/ru\/wp-json\/wp\/v2\/comments?post=1148"}],"version-history":[{"count":1,"href":"https:\/\/notes.profidev.online\/ru\/wp-json\/wp\/v2\/posts\/1148\/revisions"}],"predecessor-version":[{"id":1151,"href":"https:\/\/notes.profidev.online\/ru\/wp-json\/wp\/v2\/posts\/1148\/revisions\/1151"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/notes.profidev.online\/ru\/wp-json\/wp\/v2\/media\/1149"}],"wp:attachment":[{"href":"https:\/\/notes.profidev.online\/ru\/wp-json\/wp\/v2\/media?parent=1148"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/notes.profidev.online\/ru\/wp-json\/wp\/v2\/categories?post=1148"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/notes.profidev.online\/ru\/wp-json\/wp\/v2\/tags?post=1148"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}