Decided to tackle this on my own, the solution is to approach it from a different angle.
- Avoid adjusting the vertical-align of the text
- Focus on adjusting the vertical align of the font-awesome icon
<div>
<span class="icon icon-2x icon-camera" style=" vertical-align: middle;"></span>
<span class="my-text">hello world</span>
</div>
Instead of using inline styles, consider targeting it with a custom CSS class. However, if you prefer a simple copy-paste solution, this method will do the trick.
Check out the technique here:
Vertical alignment of text and icon in button
If it were up to me, I would opt out of using icon-2x and personally define the font-size as shown below
<div class='my-fancy-container'>
<span class='my-icon icon-file-text'></span>
<span class='my-text'>Hello World</span>
</div>
.my-icon {
vertical-align: middle;
font-size: 40px;
}
.my-text {
font-family: "Courier-new";
}
.my-fancy-container {
border: 1px solid #ccc;
border-radius: 6px;
display: inline-block;
margin: 60px;
padding: 10px;
}
For a live example, visit JsFiddle