I'm having trouble vertically aligning a font-awesome icon with text within a button under the Bootstrap framework. I've tried so many things including setting the line-height, but nothing is working.
<button id="edit-listing-form-house_Continue"
class="btn btn-large btn-primary"
style=""
value=""
name="Continue"
type="submit">
Continue
<i class="icon-ok" style="font-size:40px;"></i>
</button>
How can I get this to work?
Alternativly if your using bootstrap then you can just add
align-middle
to vertical align the element.There is one rule that is set by
font-awesome.css
, which you need to override.You should set overrides in your CSS files rather than inline, but essentially, the icon-ok class is being set to
vertical-align: baseline;
by default and which I've corrected here:Example here: http://jsfiddle.net/fPXFY/4/ and the output of which is:
I've downsized the font-size of the icon above in this instance to
30px
, as it feels too big at40px
for the size of the button, but this is purely a personal viewpoint. You could increase the padding on the button to compensate if required:Producing: http://jsfiddle.net/fPXFY/5/ the output of which is: