Skip to content

Commit 099d9c2

Browse files
committed
Image Expension Added
1 parent 920b48e commit 099d9c2

File tree

3 files changed

+104
-0
lines changed

3 files changed

+104
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
| 27 | [Typing Effect](https://github.com/sahilatahar/HTML-CSS-JavaScript/tree/main/typing-effect) | [Live Demo](https://sahilatahar.github.io/HTML-CSS-JavaScript/typing-effect/) |
3535
| 28 | [Word Counter](https://github.com/sahilatahar/HTML-CSS-JavaScript/tree/main/word-counter) | [Live Demo](https://sahilatahar.github.io/HTML-CSS-JavaScript/word-counter/) |
3636
| 29 | [Git Logo](https://github.com/sahilatahar/HTML-CSS-JavaScript/tree/main/git-logo) | [Live Demo](https://sahilatahar.github.io/HTML-CSS-JavaScript/git-logo/) |
37+
| 30 | [Image Expansion](https://github.com/sahilatahar/HTML-CSS-JavaScript/tree/main/image-expansion) | [Live Demo](https://sahilatahar.github.io/HTML-CSS-JavaScript/image-expansion/) |
3738

3839

3940

image-expansion/index.html

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
8+
<title>Image Expansion</title>
9+
<link rel="stylesheet" href="style.css">
10+
</head>
11+
12+
<body>
13+
<div class="container">
14+
<img src="https://cdn.pixabay.com/photo/2020/07/21/18/21/cornflower-5427048_960_720.jpg" alt="image 1"
15+
class="image-1">
16+
<img src="https://cdn.pixabay.com/photo/2023/04/21/15/35/fusilier-tulip-7942127_960_720.jpg" alt="image 2">
17+
<img src="https://cdn.pixabay.com/photo/2023/04/23/14/31/roses-7945822_960_720.jpg" alt="image 3">
18+
19+
</div>
20+
</body>
21+
22+
</html>

image-expansion/style.css

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
* {
2+
padding: 0;
3+
margin: 0;
4+
box-sizing: border-box;
5+
}
6+
7+
body {
8+
height: 100vh;
9+
display: grid;
10+
place-items: center;
11+
}
12+
13+
.container {
14+
width: 500px;
15+
height: 300px;
16+
max-width: 90vw;
17+
display: flex;
18+
gap: 0.5rem;
19+
justify-content: center;
20+
}
21+
22+
.container>img {
23+
aspect-ratio: 1;
24+
object-fit: cover;
25+
border-radius: 15px;
26+
transition: all 0.6s;
27+
}
28+
29+
.container>img:hover {
30+
width: 65%;
31+
}
32+
33+
.container>img:not(:hover) {
34+
width: 15%;
35+
opacity: 0.7;
36+
}
37+
38+
.container>img:first-of-type:not(:hover) {
39+
width: 65%;
40+
}
41+
42+
* {
43+
padding: 0;
44+
margin: 0;
45+
box-sizing: border-box;
46+
}
47+
48+
body {
49+
height: 100vh;
50+
min-height: 100vh;
51+
display: grid;
52+
place-items: center;
53+
background: #c8d6e5;
54+
}
55+
56+
.container {
57+
width: 500px;
58+
height: 300px;
59+
max-width: 90vw;
60+
display: flex;
61+
gap: 0.5rem;
62+
justify-content: center;
63+
}
64+
65+
.container>img:hover {
66+
width: 65%;
67+
}
68+
69+
.container>img:not(:hover) {
70+
width: 15%;
71+
opacity: 0.7;
72+
}
73+
74+
.container>img:first-of-type:not(:hover) {
75+
width: 65%;
76+
opacity: 1;
77+
}
78+
79+
.container:hover>img:not(:hover) {
80+
width: 15%;
81+
}

0 commit comments

Comments
 (0)