<details>
<summary>Look Ma. <strong>No JavaScript</strong>. 🤓</summary>
<div class="content">
<p>
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Modi unde, ex rem voluptates autem aliquid veniam quis temporibus repudiandae illo, nostrum, pariatur quae! At animi modi dignissimos corrupti placeat voluptatum!
</p>
<img src="https://placebear.com/400/200" alt="">
<p>
Facilis ducimus iure officia quos possimus quaerat iusto, quas, laboriosam sapiente autem ab assumenda eligendi voluptatum nisi eius cumque, tempore reprehenderit optio placeat praesentium non sint repellendus consequuntur? Nihil, soluta.
</p>
</div>
</details>
<details>
<summary>These work with just <strong>CSS</strong> and <strong>Semantic HTML</strong> 👍</summary>
<div class="content">
<p>
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Modi unde, ex rem voluptates autem aliquid veniam quis temporibus repudiandae illo, nostrum, pariatur quae! At animi modi dignissimos corrupti placeat voluptatum!
</p>
<img src="https://placebear.com/400/200" alt="">
<p>
Facilis ducimus iure officia quos possimus quaerat iusto, quas, laboriosam sapiente autem ab assumenda eligendi voluptatum nisi eius cumque, tempore reprehenderit optio placeat praesentium non sint repellendus consequuntur? Nihil, soluta.
</p>
</div>
</details>
<details>
<summary>Click or Tap <strong>ANYWHERE</strong> to expand with a <strong>Sliding Effect</strong></summary>
<div class="content">
<p>
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Modi unde, ex rem voluptates autem aliquid veniam quis temporibus repudiandae illo, nostrum, pariatur quae! At animi modi dignissimos corrupti placeat voluptatum!
</p>
<img src="https://placebear.com/400/200" alt="">
<p>
Facilis ducimus iure officia quos possimus quaerat iusto, quas, laboriosam sapiente autem ab assumenda eligendi voluptatum nisi eius cumque, tempore reprehenderit optio placeat praesentium non sint repellendus consequuntur? Nihil, soluta.
</p>
</div>
</details>
<details class="style2">
<summary>Another <strong>STYLE</strong> of indicator.</summary>
<div class="content">
<p>
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Modi unde, ex rem voluptates autem aliquid veniam quis temporibus repudiandae illo, nostrum, pariatur quae! At animi modi dignissimos corrupti placeat voluptatum!
</p>
<img src="https://placebear.com/400/200" alt="">
<p>
Facilis ducimus iure officia quos possimus quaerat iusto, quas, laboriosam sapiente autem ab assumenda eligendi voluptatum nisi eius cumque, tempore reprehenderit optio placeat praesentium non sint repellendus consequuntur? Nihil, soluta.
</p>
</div>
</details>
<details class="style3">
<summary>Yet another <strong>STYLE</strong> of indicator.</summary>
<div class="content">
<p>
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Modi unde, ex rem voluptates autem aliquid veniam quis temporibus repudiandae illo, nostrum, pariatur quae! At animi modi dignissimos corrupti placeat voluptatum!
</p>
<img src="https://placebear.com/400/200" alt="">
<p>
Facilis ducimus iure officia quos possimus quaerat iusto, quas, laboriosam sapiente autem ab assumenda eligendi voluptatum nisi eius cumque, tempore reprehenderit optio placeat praesentium non sint repellendus consequuntur? Nihil, soluta.
</p>
</div>
</details>
<details class="style4">
<summary>Yet another <strong>STYLE</strong> of indicator.</summary>
<div class="content">
<p>
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Modi unde, ex rem voluptates autem aliquid veniam quis temporibus repudiandae illo, nostrum, pariatur quae! At animi modi dignissimos corrupti placeat voluptatum!
</p>
<img src="https://placebear.com/400/200" alt="">
<p>
Facilis ducimus iure officia quos possimus quaerat iusto, quas, laboriosam sapiente autem ab assumenda eligendi voluptatum nisi eius cumque, tempore reprehenderit optio placeat praesentium non sint repellendus consequuntur? Nihil, soluta.
</p>
</div>
</details>
<details class="style5">
<summary><span class="monkey-see">What does monkey <strong>KNOW</strong>?</span><span class="monkey-hide"><strong>SHHHHHHHHH</strong> be quite monkey!</span></summary>
<div class="content">
<p>
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Modi unde, ex rem voluptates autem aliquid veniam quis temporibus repudiandae illo, nostrum, pariatur quae! At animi modi dignissimos corrupti placeat voluptatum!
</p>
<img src="https://placemonkeys.com/400/200" alt="">
<p>
Facilis ducimus iure officia quos possimus quaerat iusto, quas, laboriosam sapiente autem ab assumenda eligendi voluptatum nisi eius cumque, tempore reprehenderit optio placeat praesentium non sint repellendus consequuntur? Nihil, soluta.
</p>
</div>
</details>
<details class="style6">
<summary>Yet another <strong>STYLE</strong> of indicator.</summary>
<div class="content">
<p>
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Modi unde, ex rem voluptates autem aliquid veniam quis temporibus repudiandae illo, nostrum, pariatur quae! At animi modi dignissimos corrupti placeat voluptatum!
</p>
<img src="https://placebear.com/400/200" alt="">
<p>
Facilis ducimus iure officia quos possimus quaerat iusto, quas, laboriosam sapiente autem ab assumenda eligendi voluptatum nisi eius cumque, tempore reprehenderit optio placeat praesentium non sint repellendus consequuntur? Nihil, soluta.
</p>
</div>
</details>
<details class="style7">
<summary><span class="moon-new">Want to learn about the <strong>MOON</strong>?</span><span class="moon-full">The <strong>MOON</strong> is <strong>AMAZING</strong>!</span></summary>
<div class="content">
<p>
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Modi unde, ex rem voluptates autem aliquid veniam quis temporibus repudiandae illo, nostrum, pariatur quae! At animi modi dignissimos corrupti placeat voluptatum!
</p>
<img src="https://spaceholder.cc/400x200" alt="">
<p>
Facilis ducimus iure officia quos possimus quaerat iusto, quas, laboriosam sapiente autem ab assumenda eligendi voluptatum nisi eius cumque, tempore reprehenderit optio placeat praesentium non sint repellendus consequuntur? Nihil, soluta.
</p>
</div>
</details>
/* # The Rotating Marker # */
details summary::-webkit-details-marker { display: none; }
summary::before {
font-family: "Hiragino Mincho ProN", "Open Sans", sans-serif;
content: "▶";
position: absolute;
top: 1rem;
left: 0.8rem;
transform: rotate(0);
transform-origin: center;
transition: 0.2s transform ease;
}
details[open] > summary:before {
transform: rotate(90deg);
transition: 0.45s transform ease;
}
/* # The Sliding Summary # */
details { overflow: hidden; }
details summary {
position: relative;
z-index: 10;
}
@keyframes details-show {
from {
margin-bottom: -80%;
opacity: 0;
transform: translateY(-100%);
}
}
details > *:not(summary) {
animation: details-show 500ms ease-in-out;
position: relative;
z-index: 1;
transition: all 0.3s ease-in-out;
color: transparent;
overflow: hidden;
}
details[open] > *:not(summary) { color: inherit; }
/* # Style 2 # */
details.style2 summary::before {
content: "×";
color: #FFF;
font-size: 2rem;
line-height: 1rem;
transform: rotate(-45deg);
top: 1.2rem;
left: 0.5rem;
}
details[open].style2 > summary:before {
transform: rotate(90deg);
color: #F00 !important;
transition: color ease 2s, transform ease 1s;
}
/* # Style 3 # */
details.style3 summary::before {
content: "›";
font-size: 2.5rem;
line-height: 1rem;
top: 1.3rem;
left: 0rem;
margin: -0.5rem -0.5rem 0 0.5rem;
transform-origin: bottom center;
transition: margin linear 0.05s;
}
details.style3:hover > summary:before {
color: #FFF;
}
details[open].style3 > summary:before {
left: 0rem;
color: #CCC;
transform: rotate(90deg);
margin-left: 0.4rem;
transition: color ease 2s, transform ease 1s, margin ease 1s;
}
@supports (-webkit-touch-callout: none) {
details.style3 summary::before { top: 1.6rem; }
details[open].style3 > summary:before { top: 1.3rem; transition: all 0.8s; }
}
/* # Style 4 # */
details.style4 summary {
padding-right: 2.2rem;
padding-left: 1rem;
}
details.style4 summary::before {
content: "×";
color: #FFF;
font-size: 2rem;
line-height: 1rem;
transform: rotate(-45deg);
top: 1.2rem;
left: unset;
right: 0.6rem;
}
details[open].style4 > summary:before {
transform: rotate(90deg);
color: #F00 !important;
transition: color ease 2s, transform ease 1s;
}
/* # Style 5 # */
details.style5 summary {
padding-right: 2.2rem;
padding-left: 1rem;
}
details.style5 summary::before {
content: "🙈";
font-size: 1.5rem;
top: 0.5rem;
left: unset;
right: 0.5rem;
transform: rotate(0);
}
details.style5:hover > summary::before {
content: "🙊";
}
details[open].style5 > summary::before {
content: "🐵";
transform: rotate(0deg);
}
details[open].style5 > summary:hover::before {
content: "🙉";
}
details .monkey-see { display: inline; }
details .monkey-hide { display: none; }
details[open] .monkey-see { display: none; }
details[open] .monkey-hide { display: inline; }
/* # Style 6 # */
details.style6 summary {
padding-right: 2.2rem;
padding-left: 1rem;
}
details.style6 summary::before {
content: "❔";
font-size: 1.5rem;
top: 0.5rem;
left: unset;
right: 0.5rem;
transform: rotate(0);
}
details.style6:hover > summary:before {
content: "👁️🗨️";
}
details[open].style6 > summary:before {
content: "❌";
transform: rotate(0deg);
}
/* # Style 7 # */
details.style7 summary {
padding-left: 3rem;
}
details[open].style7 summary,
details.style7:hover summary {
background: #000;
color: #CCC;
}
details[open].style7 summary strong,
details.style7:hover summary strong {
color: #FDCE4C;
}
details.style7:hover summary strong { color: #ffdf87; }
details.style7 summary::before {
content: "🌑";
font-size: 1.5rem;
top: 0.5rem;
left: 0.5rem;
transform: rotate(0);
}
details.style7:hover > summary::before {
content: "🌕";
}
details[open].style7 > summary::before {
content: "🌕";
transform: rotate(0deg);
}
details[open].style7 > summary:hover::before {
content: "🌕";
}
details .moon-new { display: inline; }
details .moon-full { display: none; }
details[open] .moon-new { display: none; }
details[open] .moon-full { display: inline; }
details.style7 .content { background: #DDD; }
/* # Just Some Pretty Styles # */
body { font-family: "Open Sans", sans-serif; padding-bottom: 400px; }
img { max-width: 100%; }
p { margin: 0; padding-bottom: 10px; }
p:last-child { padding: 0; }
details {
max-width: 500px;
box-sizing: border-box;
margin-top: 5px;
background: white;
}
summary {
border: 4px solid transparent;
outline: none;
padding: 1rem;
display: block;
background: #666;
color: white;
padding-left: 2.2rem;
position: relative;
cursor: pointer;
}
details[open] summary,
summary:hover {
color: #FFCA28;
background: #444;
}
summary:hover strong,
details[open] summary strong,
summary:hover::before,
details[open] summary::before {
color: #FFA128;
}
.content {
padding: 10px;
border: 2px solid #888;
border-top: none;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.