<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://dl.dropboxusercontent.com/u/86701580/mypersonalcdn/renda/renda-icon-font.css">
<div class="container">
<h3>Beds and Baths Radio Button Group</h3>
<div class="btn-group beds-baths-group"id="beds-baths-group" data-toggle="buttons">
<div class="first-label btn btn-default beds-baths">
<span class="icon icon-baths"></span>
</div>
<label class="btn btn-default beds-baths beds-baths-1 active">
<input type="radio" name="options" id="option1" autocomplete="off">
<span class="icon icon-blank-space"></span>
<span class="beds-baths-word">1</span>
</label>
<label class="btn btn-default beds-baths beds-baths-2">
<input type="radio" name="options" id="option2" autocomplete="off">
<span class="icon icon-blank-space"></span>
<span class="beds-baths-word">2</span>
</label>
<span class="beds-baths-clearfix"></span>
<label class="btn btn-default beds-baths beds-baths-3">
<input type="radio" name="options" id="option2" autocomplete="off">
<span class="icon icon-blank-space"></span>
<span class="beds-baths-word">3</span>
</label>
<label class="btn btn-default beds-baths beds-baths-4">
<input type="radio" name="options" id="option2" autocomplete="off">
<span class="icon icon-blank-space"></span>
<span class="beds-baths-word">4</span>
</label>
<span class="beds-baths-clearfix"></span>
<label class="btn btn-default beds-baths beds-baths-5">
<input type="radio" name="options" id="option2" autocomplete="off">
<span class="icon icon-blank-space"></span>
<span class="beds-baths-word">5</span>
</label>
<label class="btn btn-default beds-baths beds-baths-6">
<input type="radio" name="options" id="option2" autocomplete="off">
<span class="icon icon-blank-space"></span>
<span class="beds-baths-word">6</span>
</label>
<span class="beds-baths-clearfix"></span>
<label class="btn btn-default beds-baths beds-baths-7">
<input type="radio" name="options" id="option2" autocomplete="off">
<span class="icon icon-blank-space"></span>
<span class="beds-baths-word">7</span>
</label>
<label class="btn btn-default beds-baths beds-baths-8">
<input type="radio" name="options" id="option2" autocomplete="off">
<span class="icon icon-blank-space"></span>
<span class="beds-baths-word">8</span>
</label>
<span class="beds-baths-clearfix"></span>
<label class="btn btn-default beds-baths beds-baths-9">
<input type="radio" name="options" id="option2" autocomplete="off">
<span class="icon icon-blank-space"></span>
<span class="beds-baths-word">Any</span>
</label>
</div>
</div>
body {
font-family: "open sans", Helvetica, Arial, sans-serif
}
.beds-baths span.icon {
opacity: 1;
color: #909090;
font-size: 32px;
width: 27px;
display: block;
margin: 0 auto;
height: 24px;
line-height: 24px;
}
.icon-blank-space {
text-indent: -9999px
}
.beds-baths.active span.icon {
opacity: 0;
color: #fff;
font-size: 20px;
width: 27px;
}
.beds-baths-group .beds-baths.active:first-child span.icon {
opacity: 1;
color: #909090;
font-size: 32px;
width: 27px;
display: block;
margin: 0 auto;
height: 24px;
line-height: 24px;
}
.beds-baths-group .beds-baths:first-child, .beds-baths-group .beds-baths:hover:first-child, .beds-baths-group .beds-baths:active:first-child, .beds-baths-group .beds-baths:focus:first-child {
background: #F3F3F3;
border-color: #ccc;
box-shadow: none;
-webkit-box-shadow: none;
cursor: default;
color: #909090;
}
.beds-baths.active {
background: #7BB712;
}
.container {
width: 100%;
margin: 0 auto;
}
.beds-baths {
width: 10%
}
.beds-baths-group {
width: 100%
}
.beds-baths-word {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
line-height: 34px;
width: 100%;
margin: 0 auto;
font-size: 14px;
font-weight: bold;
color: #909090;
}
.beds-baths.active .beds-baths-word {
color: #fff;
}
.mobile-br {
display: block;
}
.beds-baths-clearfix {
display: none;
clear: both;
}
@media (max-width: 600px) {
.beds-baths {
text-align: left;
margin-bottom: 0px !important;
}
.beds-baths-word {
display: block;
position: absolute;
width: 100%;
margin: 0 auto;
font-size: 17px;
top: 0;
left: 0;
bottom: 0;
right: 0;
font-weight: bold;
text-align: center;
}
.beds-baths-1,
.beds-baths-2,
.beds-baths-3,
.beds-baths-4,
.beds-baths-5,
.beds-baths-6,
.beds-baths-7,
.beds-baths-8 {
width: 50% !important;
margin-top: -1px;
margin-bottom: -1px;
}
.beds-baths-2,
.beds-baths-4,
.beds-baths-6,
.beds-baths-8 {
float: right !important;
}
.beds-baths-1,
.beds-baths-3,
.beds-baths-5,
.beds-baths-7 {
float: left !important;
}
.bed-baths-9 {
width: 100% !important;
}
.beds-baths.active .beds-baths-word {
color: #fff;
}
.beds-baths-clearfix {
display: block;
clear: both;
}
.mobile-br {
display: none;
}
}
$(window).resize(function() {
if ($(window).width() <= 600) {
$('#beds-baths-group').removeClass('btn-group');
$('#beds-baths-group').addClass('btn-group-vertical');
} else {
$('#beds-baths-group').addClass('btn-group');
$('#beds-baths-group').removeClass('btn-group-vertical');
}
});