Home >Web Front-end >CSS Tutorial >Just use CSS to center the top, bottom, left, and right of the image in the container
.main{ width:600px; height:400px; margin:100px auto;text-align:center;vertical-align:middle;display:block;position:relative; background:#ddd;} .main a{display:table-cell;vertical-align:middle;width:600px; height:400px; } .main a img{max-width:600px;max-height:400px; }