Home >Web Front-end >HTML Tutorial >CSS style for vertically centered images in DIV_html/css_WEB-ITnose

CSS style for vertically centered images in DIV_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:28:031179browse

As we all know, horizontal centering of images is relatively simple, but vertical centering of images is more troublesome. Today I checked the information and wrote my own test code to achieve compatibility with mainstream browsers such as IE, FF, and chrome. How to vertically center an image in a div.

The css style code is as follows: