Reputation: 1637
I'm having problems aligning two spans together. The second span starts slightly lower than the first one which is causing a mis-alignment of the spans.
Essentially I'm trying to align .cbtnSymbol and .cbtnLabel together so that they are starting at the same height.
Here is a testcase: http://jsfiddle.net/DwGEa/
Upvotes: 0
Views: 1926
Reputation: 198
I'm not sure how you will feel about this, but it looks like you already have your divs setup as a table. So what about trying something like this:
<table class="cmenu">
<tr class="cbtn add">
<td class="cbtnSymbol">+</td>
<td class="cbtnLabel">Add</td>
</tr>
<tr class="cbtn add">
<td class="cbtnSymbol">-</td>
<td class="cbtnLabel">Delete</td>
</tr>
</table>
By doing this, you can get rid of some CSS for simplicity. (example: you won't need display:inline-block anymore)
DEMO http://jsfiddle.net/DwGEa/37/
Upvotes: 0
Reputation: 5747
Add the last four CSS properties additionally to your label tag CSS
.cbtnLabel {
padding: 0 0 0 10px;
font-size: 8px;
height: 30px;
display: inline-block;
display: -moz-inline-stack;
vertical-align:top;
zoom: 1;
*display: inline;
}
Upvotes: 0
Reputation: 3213
Here you go: http://jsfiddle.net/DwGEa/19/
Just add line-height: 30px; vertical-align:middle;
to .cbtnLabel
Upvotes: 0
Reputation: 18962
Adding line-height and vertical-align seems to help, but I'm not 100% sure what final result you are after.
<div class="cmenu">
<div class="cbtn add"><span class="cbtnSymbol">+</span><span class="cbtnLabel" style="line-height: 20px; vertical-align: top;">Add</span></div>
<div class="cbtn add"><span class="cbtnSymbol">-</span><span class="cbtnLabel" style="line-height: 20px; vertical-align: top;">Delete</span></div>
</div>
Here's the modified jsFiddle: http://jsfiddle.net/DwGEa/11/
Upvotes: 0