1 <!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
4 <title>CSS Test: Min/Max Height and Width Constraints on Replaced Elements
</title>
5 <link rel=
"author" title=
"Elika J. Etemad" href=
"http://fantasai.inkedblade.net/contact">
6 <link rel=
"reviewer" title=
"Ian Hickson" href=
"mailto:ian@hixie.ch">
7 <link rel=
"alternate" href=
"http://www.hixie.ch/tests/adhoc/css/box/replaced/intrinsic/001.html" type=
"text/html">
8 <meta name=
"flags" content=
"image">
9 <link rel=
"help" href=
"http://www.w3.org/TR/CSS21/visudet.html#min-max-widths">
10 <style type=
"text/css">
12 /* Make test easier to check */
13 p
{ display: inline
; }
15 /* Diagrams are scaled so that w and h line up.
16 Image is 75px x 75px; target dimensions will thus be 75px. */
21 * |------------------+------+---------+------> width
23 * |-------------+-----------+-----+----------> height
28 #img1 {min-width: 60px;
36 * |------------------+------+----------------> width
38 * |------------+------------+----------------> height
40 * target: [wmax, wmax * h/w]
43 #img2 {max-width: 75px; /* 50% */
44 min-height: 60px; /* 40% */}
50 * |-------------+-----------+----------------> width
52 * |------------------+------+----------------> height
54 * target: [wmax, hmin]
57 #img3 {max-width: 75px; /* 25% */
58 min-height: 75px; /* 50% */}
64 * |-------------+---------+------------------> width
66 * |-------------+----------------+-----------> height
68 * target: [wmin, wmin * h/w]
71 #img4 {min-width: 75px; /* 300% */
72 max-height: 100px; /* 400% */}
78 * |-------------+----------------+-----------> width
80 * |-------------+---------+------------------> height
82 * target: [wmin, hmax]
85 #img5 {min-width: 75px; /* 300% */
86 max-height: 75px; /* 150% */}
92 * |------------+------------+----------------> width
94 * |------------------+------+----------------> height
96 * target: [hmax * w/h, hmax]
99 #img6 {min-width: 60px; /* 40% */
100 max-height: 75px; /* 50% */}
106 * |------------------+------+----------------> width
108 * |-------------+-----------+----------------> height
110 * target: [wmin, hmax]
113 #img7 {min-width: 75px; /* 50% */
114 max-height: 75px; /* 25% */}
120 * |-------------+----------------+-----------> height
122 * |-------------+---------+------------------> width
124 * target: [hmin * w/h, hmin]
127 #img8 {max-width: 100px; /* 400% */
128 min-height: 75px; /* 300% */}
134 * |-------------+---------+------------------> width
136 * |-------------+----------------+-----------> height
138 * target: [wmax, hmin]
141 #img9 {max-width: 75px; /* 150% */
142 min-height: 75px; /* 300% */}
144 /* (w > max-width) and (h > max-height)
145 * (wmin/w > hmax/h) and (wmin/w > hmax/h)
148 * |------------------+------+-------+--------> width
150 * |-------------+-------------------+--------> height
152 * target: [wmin, hmax]
155 #img10 { min-width: 75px; /* 25% */
156 max-width: 150px; /* 50% */
157 max-height: 75px; /* 20% */}
159 /* (w > max-width) and (h > max-height)
160 * (wmax/w > hmax/h) and (wmin/w < hmax/h)
163 * |---------+---------------+-------+--------> width
165 * |-------------+-------------------+--------> height
167 * target: [hmax * w/h, hmax]
170 #img11 { min-width: 25px; /* 10% */
171 max-width: 225px; /* 90% */
172 max-height: 75px; /* 30% */}
174 /* (w > max-width) and (h > max-height)
175 * (wmax/w < hmax/h) and (wmax/w < hmin/h)
178 * |-------------+-------------------+--------> width
180 * |------------------+------+-------+--------> height
182 * target: [wmax, hmin]
185 #img12 { max-width: 75px; /* 20% */
186 min-height: 75px; /* 25% */
187 max-height: 150px; /* 50% */}
189 /* (w > max-width) and (h > max-width)
190 * (wmax/w < hmax/h) and (wmax/w > hmin/h)
193 * |-------------+-------------------+--------> width
195 * |---------+---------------+-------+--------> height
197 * target: [wmax, wmax * h/w]
200 #img13 { max-width: 75px; /* 30% */
201 min-height: 25px; /* 10% */
202 max-height: 225px; /* 90% */}
204 /* (w < min-width) and (h < min-height)
205 * (wmin/w < hmin/h) and (wmax/w > hmin/h)
208 * |----------+---------+----------+----------> width
210 * |----------+-------------+-----------------> height
212 * target: [hmin * w/h, hmin]
215 #img14 { min-width: 50px; /* 200% */
216 max-width: 100px; /* 400% */
217 min-height: 75px; /* 300% */}
219 /* (w < min-width) and (h < min-height)
220 * (wmin/w < hmin/h) and (wmax/w < hmin/h)
223 * |----------+---------+----------+----------> width
225 * |----------+------------------------+------> height
227 * target: [wmax, hmin]
230 #img15 { min-width: 55px; /* 110% */
231 max-width: 75px; /* 150% */
232 min-height: 75px; /* 300% */}
234 /* (w < min-width) and (h < min-height)
235 * (wmin/w > hmin/h) and (wmin/w < hmax/h)
238 * |----------+-------------+-----------------> width
240 * |----------+---------+----------+----------> height
242 * target: [wmin, wmin * h/w]
245 #img16 { min-width: 75px; /* 300% */
246 min-height: 50px; /* 200% */
247 max-height: 100px; /* 400% */}
249 /* (w < min-width) and (h < min-height)
250 * (wmin/w > hmin/h) and (wmin/w > hmax/h)
252 * |----------+------------------------+------> width
254 * |----------+---------+----------+----------> height
256 * target: [wmin, hmax]
259 #img17 { min-width: 75px; /* 300% */
260 min-height: 55px; /* 110% */
261 max-height: 75px; /* 150% */}
263 /* (w < min-width) and (h > max-height)
266 * |-------------------------+-----+----------> width
268 * |------------------+------+----------------> height
270 * target: [wmin, hmax]
273 #img18 { min-width: 75px; /* 150% */
274 max-height: 75px; /* 75% */}
276 /* (w > max-width) and (h < min-height)
279 * |------------------+------+----------------> width
281 * |-------------------------+-----+----------> height
283 * target: [wmax, hmin]
286 #img19 { max-width: 75px; /* 75% */
287 min-height: 75px; /* 150% */}
292 <div>All twenty images should be identically square.
</div>
293 <p><img src=
"resources/replaced-min-max.png" alt=
"FAIL" title=
"Test 0"></p> <!-- Control -->
294 <p><img src=
"resources/replaced-min-max-1.png" alt=
"FAIL" title=
"Test 1" id=
"img1"></p> <!-- Wi=75, Hi=75 -->
295 <p><img src=
"resources/replaced-min-max-2.png" alt=
"FAIL" title=
"Test 2" id=
"img2"></p> <!-- Wi=150, Hi=150 -->
296 <p><img src=
"resources/replaced-min-max-3.png" alt=
"FAIL" title=
"Test 3" id=
"img3"></p> <!-- Wi=300, Hi=150 -->
297 <p><img src=
"resources/replaced-min-max-4.png" alt=
"FAIL" title=
"Test 4" id=
"img4"></p> <!-- Wi=25, Hi=25 -->
298 <p><img src=
"resources/replaced-min-max-5.png" alt=
"FAIL" title=
"Test 5" id=
"img5"></p> <!-- Wi=25, Hi=50 -->
299 <p><img src=
"resources/replaced-min-max-6.png" alt=
"FAIL" title=
"Test 6" id=
"img6"></p> <!-- Wi=150, Hi=150 -->
300 <p><img src=
"resources/replaced-min-max-7.png" alt=
"FAIL" title=
"Test 7" id=
"img7"></p> <!-- Wi=150, Hi=300 -->
301 <p><img src=
"resources/replaced-min-max-8.png" alt=
"FAIL" title=
"Test 8" id=
"img8"></p> <!-- Wi=25, Hi=25 -->
302 <p><img src=
"resources/replaced-min-max-9.png" alt=
"FAIL" title=
"Test 9" id=
"img9"></p> <!-- Wi=50, Hi=25 -->
303 <p><img src=
"resources/replaced-min-max-10.png" alt=
"FAIL" title=
"Test 10" id=
"img10"></p> <!-- Wi=300, Hi=375 -->
304 <p><img src=
"resources/replaced-min-max-11.png" alt=
"FAIL" title=
"Test 11" id=
"img11"></p> <!-- Wi=250, Hi=250 -->
305 <p><img src=
"resources/replaced-min-max-12.png" alt=
"FAIL" title=
"Test 12" id=
"img12"></p> <!-- Wi=375, Hi=300 -->
306 <p><img src=
"resources/replaced-min-max-13.png" alt=
"FAIL" title=
"Test 13" id=
"img13"></p> <!-- Wi=250, Hi=250 -->
307 <p><img src=
"resources/replaced-min-max-14.png" alt=
"FAIL" title=
"Test 14" id=
"img14"></p> <!-- Wi=25, Hi=25 -->
308 <p><img src=
"resources/replaced-min-max-15.png" alt=
"FAIL" title=
"Test 15" id=
"img15"></p> <!-- Wi=50, Hi=25 -->
309 <p><img src=
"resources/replaced-min-max-16.png" alt=
"FAIL" title=
"Test 16" id=
"img16"></p> <!-- Wi=25, Hi=25 -->
310 <p><img src=
"resources/replaced-min-max-17.png" alt=
"FAIL" title=
"Test 17" id=
"img17"></p> <!-- Wi=25, Hi=50 -->
311 <p><img src=
"resources/replaced-min-max-18.png" alt=
"FAIL" title=
"Test 18" id=
"img18"></p> <!-- Wi=50, Hi=100 -->
312 <p><img src=
"resources/replaced-min-max-19.png" alt=
"FAIL" title=
"Test 19" id=
"img19"></p> <!-- Wi=100, Hi=50 -->