Skip to content

Commit c5d2f46

Browse files
committed
Positions, Float, Media Queries - z-index
1 parent 461f414 commit c5d2f46

File tree

2 files changed

+31
-54
lines changed

2 files changed

+31
-54
lines changed

index.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@
1212

1313
<body>
1414
<div class="banner">
15-
<h1>hello world, I am using media queries in CSS</h1>
15+
<img src="./small.jpeg" alt="small retro" class="first-image" />
16+
<img src="./big.jpeg" alt="big retro" class="second-image" />
17+
<img
18+
src="./images/folder-img.jpeg"
19+
alt="folder retro"
20+
class="third-image"
21+
/>
1622
</div>
1723
</body>
1824
</html>

styles.css

Lines changed: 24 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,37 @@
11
/*
2-
Media Queries
3-
Responsive Design
4-
Style Elements on Different Screen Sizes
5-
min-width: --- starting from
6-
max-width: --- up to
7-
Mobile First
2+
z-index --- z-axis
3+
0 - default
4+
does not work on position:static;
85
*/
96

10-
body {
11-
background: yellow;
7+
img {
8+
width: 250px;
9+
height: 250px;
10+
position: absolute;
1211
}
1312

1413
.banner {
15-
background: blue;
16-
color: white;
17-
text-align: center;
18-
text-decoration: underline;
19-
text-transform: capitalize;
14+
position: relative;
15+
border: 5px solid red;
16+
width: 80vw;
17+
height: 75vh;
18+
margin: 50px auto;
2019
}
2120

22-
/* @media screen and (min-width: 576px) {
23-
body {
24-
background: blue;
25-
}
26-
27-
.banner {
28-
background: yellow;
29-
color: black;
30-
font-size: 40px;
31-
}
21+
.first-image {
22+
top: 0;
23+
left: 0;
24+
z-index: 3;
3225
}
3326

34-
@media screen and (min-width: 776px) {
35-
body {
36-
background: green;
37-
}
38-
39-
.banner {
40-
background: fuchsia;
41-
color: black;
42-
}
43-
} */
44-
45-
@media screen and (max-width: 576px) {
46-
body {
47-
background: blue;
48-
}
49-
50-
.banner {
51-
background: yellow;
52-
color: black;
53-
}
27+
.second-image {
28+
top: 10%;
29+
left: 10%;
30+
z-index: 2;
5431
}
5532

56-
/* Larger max-width overrides other max-width */
57-
@media screen and (max-width: 776px) {
58-
body {
59-
background: green;
60-
}
61-
62-
.banner {
63-
background: fuchsia;
64-
color: black;
65-
}
33+
.third-image {
34+
top: 20%;
35+
left: 20%;
36+
z-index: -1;
6637
}

0 commit comments

Comments
 (0)