<input type="checkbox" id="flex" />
<label for="flex" class="switch">
  <span>block</span>
  <span class="component"></span>
  <span>flex</span>
</label>

<div class="container">
  <p>Paragraph before the &lt;hr/&gt;</p>
  <hr/>
  <p>Paragraph after the &lt;hr/&gt;</p>
</div>
/* Code of the demo */
input ~ .container {
  display: block;
}

input:checked ~ .container {
  display: flex;
  flex-direction: column;
}

/* Layout + decoration */
html, body {
  background: #ddd;
  font-family: Helvetica;
  font-size: 20px;
  font-weight: 200;
  text-align: center;
}

p {
  margin: 0;
}

input {
  -moz-appearance: none;
  -webkit-appearance: none;
  appearance: none;
  height: 0;
  left: -1000000px;
  overflow: hidden;
  position: absolute;
  width: 0;
}

hr {
  border: 0;
  border-bottom: 1px solid #222;
}

.component { 
  background: #fff;
  border: 1px solid #222;
  border-radius: 2rem;
  box-sizing: content-box;
  height: 1.4rem;
  margin: 0 0.5rem;
  position: relative;
  width: 2.5rem;
}

.component::before {
  content: "";
  background: #ccc;
  border: 1px solid #222;
  border-radius: 50%;
  box-sizing: border-box;
  display: block;
  height: 1rem;
  left: 0.2rem;
  position: absolute;
  top: 0.2rem;
  transition: left 0.25s;
  width: 1rem;
}

input:checked ~ .switch .component::before {
  left: 1.3rem;
}

.container {  
  background: white;
  border: 1px solid #222;
  border-radius: 1rem;
  left: 50%;
  max-width: 500px;
  padding: 1rem;
  position: absolute;
  text-align: left;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 50%;
}

.switch {
  align-items: center;
  display: inline-flex;
  justify-content: center;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.