So the problem is that you have a block of text and an image that is a little too large to fit the text to fit the text. For example, a smiley face. This will increase the line height of this paragraph line, making the text block ugly.
I actually already have a solution, but it is messy, and I donβt like it ... If I wrap the emoticon in a relatively positioned div and give it an absolute position, I get the effect, I after:
.holder{display:inline-block;position:relative;width:16px} .holder img{position:absolute;top:-16px} <span class="holder"><img src="/smiley.gif" height="16" width="16"></span>
But he adds extra markup. Is there a way to achieve this without adding additional HTML elements - a pure CSS solution (without javascript!)
I wonder if I am missing any overflow / vertical alignment / float / display application etc.
Many thanks!
source share