Reputation: 38960
I have a link that I want to center vertically in the .well
class from the bootstrap framework and am using the class btn btn-danger
on the anchor tag. Here's the pic below. I tried to use vertical-align:middle;
but that doesn't seem to work. You can see that the space on the well isn't even on the top and the bottom.
Here is the HTML:
<div class="well">
<%= link_to "Remove", thing, method: :delete, style: "font-size: 11px; float:right; ", :class => 'btn btn-danger'%>
</div>
Upvotes: 5
Views: 11433
Reputation: 17379
It appears you shouldn't (or simply can't) vertically align a floating element.
Here is what i suggest :
<div class="well mywell">
<div class="pull-right myfloater">
<button class="btn btn-danger vcenter">Remove</button>
</div>
<p><!-- things --></p>
</div>
.mywell{
height: 150px;
}
.myfloater {
line-height: 150px;
}
.vcenter{
vertical-align: middle;
}
The live example : http://jsfiddle.net/Sherbrow/wxM5Z/2/
Edit
Better with line-height
applied to the floating element.
Upvotes: 4