File tree Expand file tree Collapse file tree 5 files changed +109
-0
lines changed
Expand file tree Collapse file tree 5 files changed +109
-0
lines changed Original file line number Diff line number Diff line change 1+ [ CSS Tricks Blog Link] ( https://css-tricks.com/css-sprites/ )
2+
3+ [ W3School Link] ( https://www.w3schools.com/css/css_image_sprites.asp )
4+
5+ [ MDN Article Link] ( https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Images/Implementing_image_sprites_in_CSS )
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+ < head >
4+ < meta charset ="UTF-8 ">
5+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
6+ < link rel ="stylesheet " href ="style.css ">
7+ < title > Image Sprites</ title >
8+ </ head >
9+ < body >
10+ < h1 class ="title "> Image Sprites Demo</ h1 >
11+ < div class ="original-image ">
12+ < h1 > ORIGINAL IMAGE</ h1 >
13+ < img src ="sprite.webp " alt ="sprite image ">
14+ </ div >
15+ < div class ="result ">
16+ < div class ="country ">
17+ < h1 > CANADA</ h1 >
18+ < div class ="flags-canada "> </ div >
19+ </ div >
20+ < div class ="country ">
21+ < h1 > USA</ h1 >
22+ < div class ="flags-usa "> </ div >
23+ </ div >
24+ < div class ="country ">
25+ < h1 > MEXICO</ h1 >
26+ < div class ="flags-mexico "> </ div >
27+ </ div >
28+ </ div >
29+ </ body >
30+ </ html >
Original file line number Diff line number Diff line change 1+ * {
2+ margin : 0 ;
3+ padding : 0 ;
4+ box-sizing : border-box;
5+ }
6+
7+ body {
8+ width : 100% ;
9+ height : 100vh ;
10+ display : grid;
11+ place-items : center;
12+ grid-template-areas :
13+ "title title"
14+ "original-image result" ;
15+ color : whitesmoke;
16+ background-color : black;
17+ }
18+
19+ .title {
20+ grid-area : title;
21+ padding : 10px ;
22+ place-self : center;
23+ border-radius : 12px ;
24+ border : 2px solid greenyellow;
25+ }
26+
27+ .original-image {
28+ grid-area : original-image;
29+ display : grid;
30+ gap : 16px ;
31+ place-items : center;
32+ }
33+
34+ .original-image img {
35+ border : 2px solid greenyellow;
36+ }
37+
38+ .result {
39+ grid-area : result;
40+ display : grid;
41+ gap : 16px ;
42+ place-items : center;
43+ }
44+
45+ .country {
46+ display : grid;
47+ gap : 16px ;
48+ place-items : center;
49+ }
50+
51+ .flags-canada ,
52+ .flags-mexico ,
53+ .flags-usa {
54+ width : 250px ;
55+ background-image : url ('sprite.webp' );
56+ background-repeat : no-repeat;
57+ border : 2px solid greenyellow;
58+ }
59+
60+ .flags-canada {
61+ height : 128px ;
62+ background-position : -5px -5px ;
63+ }
64+
65+ .flags-usa {
66+ height : 135px ;
67+ background-position : -5px -143px ;
68+ }
69+
70+ .flags-mexico {
71+ height : 147px ;
72+ background-position : -5px -288px ;
73+ }
Original file line number Diff line number Diff line change 5252 < a href ="./Scroll Snapping/index.html "> Scroll Snapping</ a >
5353 < a href ="./Orientation Lock/demo.html "> Orientation Lock</ a >
5454 < a href ="./Scratch card effect/demo.html "> Scratch card effect</ a >
55+ < a href ="./Image Sprites/demo.html "> Image Sprites</ a >
5556</ body >
5657
5758</ html >
You can’t perform that action at this time.
0 commit comments