hut-accordion
Version:
HTML UI Toolkit accordion component
202 lines (169 loc) • 3.3 kB
CSS
/* Basic layout styles */
*,
*:before,
*:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
html,
body {
margin: 0;
padding: 0;
}
html {
width: 100%;
height: 100%;
overflow: auto;
}
body {
overflow: hidden;
}
/* Fonts and other typographical settings */
html {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 100%;
line-height: 1.5;
color: #333;
}
h1,
h2,
h3,
h4,
h5,
h6 {
font-weight: 500;
line-height: 1.2;
margin: 0.8rem 0 0.4rem 0;
}
h1 {
font-size: 2.6rem;
}
h2 {
font-size: 2.15rem;
}
h3 {
font-size: 1.7rem;
}
h4 {
font-size: 1.25rem;
}
h5 {
font-size: 1rem;
}
h6 {
font-size: 0.85rem;
}
p {
margin: 0 0 0.5rem 0;
}
hr {
border: 0;
border-top: 1px solid #CCC;
height: 0;
}
/* Basic list styles */
ul,
ol {
margin: 0;
padding: 0 0 0 1.5em;
}
button {
border: 1px solid #999;
padding: 0.25em 0.75em;
background-color: #FFF;
font: inherit;
color: inherit;
transition: background-color 0.2s;
}
button:hover,
button.hover {
background-color: #EEE;
}
button:active,
button.active {
background-color: #CCC;
}
button:disabled {
background-color: #EEE;
border-color: #BBB;
color: #BBB;
}
input,
label {
display: block;
width: 100%;
}
input {
color: inherit;
font: inherit;
/* line-height must be normal in Firefox, make it the same cross-browser */
line-height: normal;
outline: none;
border: 1px solid #999;
padding: 0.25em 0.5em;
margin: 0 0 0.5rem 0;
transition: 0.2s border-color;
}
input:focus {
border-color: #666;
}
input[type="checkbox"],
input[type="radio"] {
display: inline-block;
width: auto;
padding: 0;
border: none;
}
.hut-accordion .accordion-section {
border: 1px solid #999;
padding: 0 0.5em;
margin-bottom: 0.5rem;
overflow: hidden;
}
.hut-accordion .accordion-header {
cursor: pointer;
}
.hut-accordion .accordion-header h1,
.hut-accordion .accordion-header h2,
.hut-accordion .accordion-header h3,
.hut-accordion .accordion-header h4,
.hut-accordion .accordion-header h5,
.hut-accordion .accordion-header h6 {
/* Make all headings have the same top and bottom margin */
margin: 0.5rem 0;
}
.hut-accordion .accordion-content {
overflow: hidden;
position: relative;
/* Set max-height instead of height since height cannot be transitioned */
max-height: 0;
/* Position off the screen to the left to slide in when shown */
left: -100%;
/* When transitioning out */
/* Do not wait to slide out, wait to collapse until slide out is done */
transition-property: left, max-height;
transition-delay: 0s, 0.2s;
transition-duration: 0.2s, 0s;
}
.hut-accordion .accordion-selected .accordion-content {
left: 0;
max-height: 100000px;
/* When transitioning in when no other section is being removed */
/* Immediately slide in */
transition-delay: 0s, 0s;
transition-duration: 0.3s, 0s;
}
.hut-accordion.accordion-removing .accordion-selected .accordion-content {
/* When transitioning in when another section is being removed */
/* Wait to slide in until other section is collapsed */
transition-delay: 0.2s, 0.3s;
}
body {
max-width: 600px;
margin: 0 auto;
padding: 0 10px 10px 10px;
}
#my-accordion {
max-width: 300px;
}