Reputation: 294
Something weird: when adding a non-breakable hyphen to a string in a HTML table cell, the text becomes unaligned with the other cells:
<table><tr><td>aligned</td><td>aligned-with normal hyphen</td></tr><tr><td>aligned</td><td>un‑aligned with non breakable hyphen (‑)</td></tr></table>
Any explanation/fix for this?
Upvotes: 2
Views: 208
Reputation: 678
The vertical height of that character is different for some reason. If you set the vertical align it will help it look better, but it won't change the height of your content. It may be a peculiarity of the font.
https://jsfiddle.net/1yz4mngh/14/
Html
<table>
<tr><td>-</td></tr>
<tr><td>‑</td></tr>
</table>
Css
td {
background: #cccccc;
vertical-align: text-bottom;
}
Upvotes: 1
Reputation: 2815
Vertical align is acting wonky. This should fix it.
td {
vertical-align: text-top;
}
Upvotes: 0