<div class="wrap-collabsible">
<input id="collapsible3" class="toggle" type="checkbox" />
<label for="collapsible3" class="lbl-toggle" tabindex="0">Click Me</label>
<div class="collapsible-content">
<div class="content-inner">
<form>
<input type="text" name="name" placeholder="Name" />
<input type="email" name="email" placeholder="Email" />
<textarea name="message" placeholder="Message"></textarea>
<input type="submit" value="Send" />
</form>
</div>
</div>
</div>
input[type="checkbox"] {
display: none;
}
.wrap-collabsible {
margin: 1.2rem 0;
}
.lbl-toggle {
display: block;
font-weight: bold;
font-family: monospace;
font-size: 1.2rem;
text-transform: uppercase;
text-align: center;
padding: 1rem;
color: #ddd;
background: #0069ff;
cursor: pointer;
border-radius: 7px;
transition: all 0.25s ease-out;
}
.lbl-toggle:hover {
color: #fff;
}
.lbl-toggle::before {
content: " ";
display: inline-block;
border-top: 5px solid transparent;
border-bottom: 5px solid transparent;
border-left: 5px solid currentColor;
vertical-align: middle;
margin-right: 0.7rem;
transform: translateY(-2px);
transition: transform 0.2s ease-out;
}
.toggle:checked + .lbl-toggle::before {
transform: rotate(90deg) translateX(-3px);
}
.collapsible-content {
max-height: 0px;
overflow: hidden;
transition: max-height 0.25s ease-in-out;
}
.toggle:checked + .lbl-toggle + .collapsible-content {
max-height: 350px;
}
.toggle:checked + .lbl-toggle {
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.collapsible-content .content-inner {
background: rgba(0, 105, 255, 0.2);
border-bottom: 1px solid rgba(0, 105, 255, 0.45);
border-bottom-left-radius: 7px;
border-bottom-right-radius: 7px;
padding: 0.5rem 1rem;
}
.collapsible-content form {
display: flex;
flex-direction: column;
}
.collapsible-content form > * {
margin: 1em;
}
.collapsible-content form input[type=submit] {
display: inline-flex;
align-self:flex-start;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.