My goal is to align font-awesome icon with div next to it. For some reason the font-awesome icons seem to have some margin on top of the icons on small font-sizes, which expands the wrapper div. The same does not occur with, for example, the p tag. Example can be found here:
https://jsfiddle.net/jaakkokarhu/Luw8dsa8/2/
Few points:
- The margin is not either margin of the icon element or :before pseudoelement
- It is not padding of the parent element
- The icon expands the parent the same amount until the font-size is 15px
What is causing the font-awesome icons to behave accordingly? How can I set the icon and the wrapper so that the icon is not having the top "margin"?
// This text is just for removing the ridiculous "links to JS fiddle needs to be accompanied by code" warning. Ignore this.
vertical-align:middle
to your[class^="icon"] {..}
. try. – Abbrinline-block
. if you set thewrapper
tofont-size:0
. it'll be normal again. Problem that arrises when you use inline-block is that whitespace in HTML becomes visual space on screen. – Abbr