Add collapse element
This commit is contained in:
parent
b635908eb4
commit
a35be7c4d6
2 changed files with 47 additions and 0 deletions
19
src/collapse/index.html
Normal file
19
src/collapse/index.html
Normal file
|
@ -0,0 +1,19 @@
|
|||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="./index.scss" />
|
||||
</head>
|
||||
<body>
|
||||
<p>Here's some content before</p>
|
||||
|
||||
<div class="collapse-wrapper">
|
||||
<label for="collapse">Check</label>
|
||||
<input type="checkbox" id="collapse" />
|
||||
<div class="collapse-content">
|
||||
This is the inner content
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<p>Text below the collapse, which should move out the way</p>
|
||||
</body>
|
||||
</html>
|
28
src/collapse/index.scss
Normal file
28
src/collapse/index.scss
Normal file
|
@ -0,0 +1,28 @@
|
|||
@import "normalize.css";
|
||||
|
||||
.collapse-wrapper {
|
||||
background: red;
|
||||
|
||||
.collapse-content {
|
||||
padding: 5px;
|
||||
overflow: hidden;
|
||||
|
||||
}
|
||||
|
||||
label {
|
||||
cursor: pointer;
|
||||
width: 100%;
|
||||
display: block;
|
||||
background-color: orange;
|
||||
padding: 5px;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
input[type="checkbox"] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
input[type="checkbox"]:not(:checked) + .collapse-content {
|
||||
display: none;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue