Set the row height for the picture container to the height of the container.
/* Set Line Height */
wrap_4 {width:200px; height:200px text-align:center; border:1px solid red; font-family:arial ht:198px; font-size:0; _font-size:180px; }
. wrap_4 img {display:inline-block; vertical-align:middle; max-height:200px; max-width:200px;}
View Demo
The effect of the above implementation is:
IE6 's Cup
For the adaptive image, use Max-width and max-height. The callous reality is that IE6 and the following do not support Max-width and max-height. The above is used to fix max-height,max-width expressions _width and _height in IE6, and there are minor problems at run time. Try it with a different picture, for the width and height of at least one value is less than or equal to 200 of the picture, can be perfectly displayed, but Jocquan and high both are greater than 200, there will be some minor problems.
If _width and _height are used together, x>200,y>200, and X>y pictures, will show the ideal state. x>200,y>200, and X
If _width, _height alone, you can make the corresponding picture to show the ideal state. If you use only _width, you can work with the horizontal graph, which does not work on the vertical graph.
Conversely, if only the use of _height, can work on the vertical map, the horizontal map does not work.
The conclusion is that _width and _height are all written, and this is 95% perfect. In addition to the performance of CSS expression optimization, cat did a detailed analysis for everyone's reference. For IE6 plus _width:expression (function (EL) {el.style.width = el.offsetwidth > 200? ' 200px ': El.offsetwidth + ' px '; counter (' 2′);} (this)); This sentence.