css3-background-size-contain.html (879B)
1 <!doctype html> 2 <html> 3 <head> 4 <meta charset="UTF-8"> 5 <title>CSS3 background-size:contain</title> 6 <link rel="author" title="Yue Hu" href="mailto:miniwade514@gmail.com" /> 7 <link rel="reviewer" title="Dayang Shen" href="mailto:shendayang@baidu.com" /> <!-- 2013-09-03 --> 8 <link rel="help" href="http://www.w3.org/TR/css3-background/#the-background-size" /> 9 <link rel="match" href="reference/css3-background-size-contain-ref.html"> 10 <style> 11 div { 12 width: 200px; 13 height: 250px; 14 border: 5px dashed black; 15 overflow: hidden; 16 background-image: url(support/60x60-green.png); 17 background-size: contain; 18 background-repeat: no-repeat; 19 } 20 </style> 21 </head> 22 <body> 23 <p>The test passes if the green box image is scaled to fit the width of the outer box, while preserving its intrinsic aspect ratio.</p> 24 <div></div> 25 </body> 26 </html>