原图:
Home >Web Front-end >JS Tutorial >JS CSS sets img to display only the vertically centered part of Img in DIV_javascript tips
Img is displayed in a Div. The width of img is the same as that of Div, but the height is not fixed. It is required that only the vertically centered part of Img be displayed.
Example:
Original image:
Code implementation: