<h1 class="page-header">Multi-Step Form with CSS Only</h1>
<div class="form-container">
<form action="" role="form">
<input id='step2' type='checkbox'>
<input id='step3' type='checkbox'>
<div id="part1" class="form-group">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Part 1</h3>
</div>
<input type="text" id="name" class="form-control" placeholder="Full Name" aria-describedby="sizing-addon1">
<div class="btn-group btn-group-lg" role="group" aria-label="...">
<label for='step2' id="continue-step2" class="continue">
<div class="btn btn-default btn-success btn-lg">Continue</div>
</label>
</div>
</div>
</div>
<div id="part2" class="form-group">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Part 2</h3>
</div>
<input type="email" id="email" class="form-control" placeholder="Email">
<input type="phone" id="phone" class="form-control" placeholder="Phone">
<input type="number" id="zip" class="form-control" placeholder="Zip Code">
<div class="btn-group btn-group-lg btn-group-justified" role="group" aria-label="...">
<label for='step2' id="back-step2" class="back">
<div class="btn btn-default btn-primary btn-lg" role="button">Back</div>
</label>
<label for='step3' id="continue-step3" class="continue">
<div class="btn btn-default btn-success btn-lg" role="button">Continue</div>
</label>
</div>
</div>
</div>
<div id="part3" class="form-group">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Part 3</h3>
</div>
<textarea id="message" class="form-control" placeholder="Message"></textarea>
<div class="btn-group btn-group-lg" role="group" aria-label="...">
<label for='step3' id="back-step3" class="back">
<div class="btn btn-default btn-primary btn-lg">Back</div>
</label>
<label class="continue">
<button type="submit" class="btn btn-default btn-success btn-lg">Submit</button>
</label>
</div>
</div>
</div>
</form>
</div>
body {
text-align: center;
background: url(http://subtlepatterns2015.subtlepatterns.netdna-cdn.com/patterns/upfeathers.png);
}
.form-container {
width: 100%;
max-width: 320px;
margin: 0 auto;
input[type=text], input[type=email], input[type=phone], input[type=number], textarea {
width: 90%;
margin: 20px auto;
border: 1px solid white;
box-shadow: 0 0 1px 1px white;
}
textarea {
min-height: 150px;
}
.panel {
background: rgba(0,0,0,.2);
.panel-heading {
margin-bottom: 20px;
}
}
.btn-group {
width: 90%;
margin: 0 auto 10px auto;
}
.back {
float: left;
}
.continue {
float: right;
}
}
input[type=checkbox] {
position: absolute;
opacity: 0;
}
#part1,
#part2,
#part3 {
z-index: 2;
display: block;
height: auto;
opacity: 1;
transition: opacity 1s ease-in-out;
}
#part2,
#part3 {
opacity: 0;
height: 0;
overflow: hidden;
}
#step2:checked ~ #part2 {
opacity: 1;
height: auto;
}
#step2:checked ~ #part1 {
opacity: 0;
height: 0;
display: none;
}
#step3:checked ~ #part3 {
opacity: 1;
height: auto;
}
#step3:checked ~ #part2 {
opacity: 0;
width: 0;
height: 0;
}
View Compiled