HTML & CSS · Middle · Question 66 of 75
Why is there a small gap under an <img> inside a <div>?
- ✓Correct answer: Images are inline and sit on the text baseline, leaving room for descenders; use
display: blockorvertical-align: middle - 2Browsers add a default
margin-bottomto images - 3The image file has transparent pixels at the bottom
Explanation
The space below the baseline is reserved for letters like "g" and "y". Most CSS resets set img { display: block; } for this reason.