Reputation: 1927
I'd like to use the inline labels of the bootstrap css framework:
<span class="label">Default</span>
Unfortunately these labels are not vertically centered when used together with other elements.
<p>
<span class="label"><a href="#">test</a></span>This is a test heading.
</p>
Please see the full code for a visual example: http://jsfiddle.net/kvPpm/
I am aware of the line-height and absolute/relative positioning workarounds but was not able to apply them correctly.
How can I vertically center these labels?
Upvotes: 5
Views: 26061
Reputation: 7475
.label { vertical-align: top; }
This worked for me when I wanted it to be aligned properly in a ul
Upvotes: 2
Reputation: 94101
Since <span>
is an inline
element by default you can just do:
span { vertical-align: middle|top|bottom; }
And it should work. http://jsfiddle.net/kvPpm/1/
But then <a>
inside <span>
is not semantically correct. You can just use <a>
and style it display: inline
.
Upvotes: 6