| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <style> |
| 5 .imageDiv { |
| 6 display: inline-block; |
| 7 width: 25%; |
| 8 padding-bottom: 25%; |
| 9 border: 5px solid black; |
| 10 } |
| 11 |
| 12 .firstImage { |
| 13 background-image: url(resources/red-red-green.png); |
| 14 |
| 15 /* Relative to the background positioning area. 75% of containing block
width in this case. */ |
| 16 background-size: 300% 100%; |
| 17 |
| 18 /* Relative to background positioning area - background image size. |
| 19 100 times (-50% of view width) = -5000% of containing block width. |
| 20 size is 75% of view width, so this is always 66.666 tiles, so we star
t 2/3 of the way into the image. |
| 21 */ |
| 22 background-position: 10000% 0; |
| 23 } |
| 24 |
| 25 .secondImage { |
| 26 background-image: url(resources/red-green-red.png); |
| 27 |
| 28 background-size: 300% 100%; |
| 29 |
| 30 /* As above, but now we start 1/3 of the way into the image. */ |
| 31 background-position: 20000% 0; |
| 32 } |
| 33 |
| 34 .thirdImage { |
| 35 background-image: url(resources/red-red-green-vertical.png); |
| 36 |
| 37 /* Relative to the background positioning area. 75% of containing block
width in this case. */ |
| 38 background-size: 100% 300%; |
| 39 |
| 40 /* Relative to background positioning area - background image size. |
| 41 100 times (-50% of view width) = -5000% of containing block width. |
| 42 size is 75% of view width, so this is always 66.666 tiles, so we star
t 2/3 of the way into the image. |
| 43 */ |
| 44 background-position: 0 10000%; |
| 45 } |
| 46 |
| 47 .fourthImage { |
| 48 background-image: url(resources/red-green-red-vertical.png); |
| 49 |
| 50 background-size: 100% 300%; |
| 51 |
| 52 /* As above, but now we start 1/3 of the way into the image. */ |
| 53 background-position: 0 20000%; |
| 54 } |
| 55 </style> |
| 56 </head> |
| 57 <body> |
| 58 <div style="display: block; width: 671px; height: 200px;"> |
| 59 <div class="firstImage imageDiv"></div> |
| 60 <div class="secondImage imageDiv"></div> |
| 61 </div> |
| 62 <br> |
| 63 <div style="display: block; width: 671px; height: 200px;"> |
| 64 <div class="thirdImage imageDiv"></div> |
| 65 <div class="fourthImage imageDiv"></div> |
| 66 </div> |
| 67 </body> |
| 68 </html> |
| OLD | NEW |