Solution to image gaps

image gap problem

*The reason for the gap under the picture: The height of the parent element is not set, and it is supported by the picture, so there is a gap*

*method:*

*1. Set the height for the parent element of img, which is consistent with the height of the image;*

*2. Set font-size: 0 for the parent element of img; or line-height: 0; *

*3. Convert the img tag to a block-level tag display: block;*

*4. Set the vertical alignment for the img tag img{vertical-align: not the default value baseline}*

Guess you like

Origin blog.csdn.net/pbaiking/article/details/129234569