Reputation: 180
I have 2 inline elements
inside a horizontal form and I can't vertical align the labels . Is there a clean way to do it without using hacks like display:table ?
Here is the code i tried so far: bootply
Upvotes: 2
Views: 367
Reputation: 6697
add line-height css to the label and match it with the height of the button
new css:
.btn-group label{
line-height: 35px;
}
since the .btn-group is 35px high, you make line height 35px as well.
Upvotes: 4
Reputation: 2005
Use the new CSS3 Flexbox display property.
It's easy and works perfect in every scenario.
.btn-group{
....
display:inline-flex;
justify-content:center;
}
.btn-group label{
....
align-self:center;
margin-bottom:0px;
}
Upvotes: 1