I can’t seem to wrap my head around how img tags behave alongside text in an html page.
I’ve removed margins and padding, but there always seems to be some extra space under the img or some other unexpected behavior. I’m sure theres quick CSS workaround using absolute positioning or negative margins but I’m looking for a more general solution.
Question: Can someone explain how img tags are positioned, specifically why do they get offset vertically when alongside text?
If you want the
<img>to be an inline element, you can use thevertical-alignCSS attribute to specify how the image will be aligned relative to the line of text it appears in. This page has examples under the “vertical-align on inline elements” heading.