Home >Web Front-end >CSS Tutorial >Just use CSS to center the top, bottom, left, and right of the image in the container

Just use CSS to center the top, bottom, left, and right of the image in the container

大家讲道理
大家讲道理Original
2016-11-11 09:30:151380browse

.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; }

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn