Using CSS to achieve vertical center of the image of the use of skills _ experience Exchange

Source: Internet
Author: User
The difficulty of the topic lies in two points:

vertically centered;
The picture is a permutation element, with some special features.
As to how to solve, here is a tradeoff between the relative structure of clean, CSS simple solution:

. box {
/* Vertical Centering method recognized by the mainstream browser of non IE */
Display:table-cell;
Vertical-align:middle;

/* Set Horizontal Center */
Text-align:center;

/* Hack for IE * *
*display:block;
*font-size:175px;/* about a height of 0.873,200*0.873 about 175*/
*font-family:arial;/* prevent non-utf-8 caused by hack failure problems, such as GBK encoding */

width:200px;
height:200px;
border:1px solid #eee;
}
. box img {
/* Set Picture vertically centered */
Vertical-align:middle;
}





Of course there are other solutions, not to delve into this,
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.