Skip to content

Instantly share code, notes, and snippets.

@jmakeig
Created November 17, 2017 19:36
Show Gist options
  • Save jmakeig/e7e178961cbed9d613fa505a8da56b16 to your computer and use it in GitHub Desktop.
Save jmakeig/e7e178961cbed9d613fa505a8da56b16 to your computer and use it in GitHub Desktop.
Toggleable section formatting
<section class="toggleable">
<h3>This Big Section with a Very Long Title That Should Wrap Over Multiple Lines that Will Break a Brittle Layout Really Badly</h3>
<p>Lorem ipsum dolor amet locavore yuccie PBR&amp;B, palo santo viral quinoa cred. Hot chicken jianbing bitters poutine palo santo banh mi vice food truck. Edison bulb chillwave vegan, cardigan hell of next level green juice hexagon microdosing. VHS disrupt waistcoat air plant yuccie meh la croix butcher adaptogen tilde, meggings paleo keytar bitters venmo. Live-edge lyft sustainable, hell of knausgaard glossier raclette. Aesthetic seitan mlkshk, tattooed kinfolk austin vexillologist cray cold-pressed. Pour-over brooklyn VHS wayfarers lyft meditation.</p>
<p>Put a bird on it air plant keytar yuccie chambray flexitarian. Wayfarers flannel bushwick, skateboard palo santo hammock slow-carb yuccie vape. Master cleanse pickled tumeric unicorn tattooed disrupt, forage bicycle rights crucifix sustainable skateboard yuccie la croix. Actually subway tile chia YOLO, messenger bag narwhal XOXO VHS fanny pack letterpress. Freegan XOXO yuccie blog everyday carry cliche VHS brooklyn fingerstache mixtape migas irony twee. Activated charcoal listicle pop-up viral, four loko YOLO church-key.</p>
</section>
body {
padding: 2rem 1rem; /* Need to leave room for the negative top margin on the heading */
font-family: 'Helvetica Neue', Helvetica, sans-serif;
line-height: 1.45;
}
section.toggleable h3 {
margin-top: -2.5rem; /* Bump up to avoid intersection with section border */
text-indent: -1rem;
margin-left: 0rem;
}
section.toggleable h3:before {
display: inline-block;
content: '▼';
font-size: 50%;
width: 1rem;
text-align: center;
vertical-align: middle;
color: inherit;
padding: 2px 0;
/*background: orange;*/
}
section.toggleable {
border-left: dotted 1px #ccc;
padding: 1rem 1rem 0 1rem;
}
h1, h2, h3, h4, h5, h6 {
line-height: 1.1;
}
p, ul, ol {
margin: 0.5em 0 1em 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment