Skip to content

Commit cf42fa4

Browse files
Add files via upload
1 parent a977150 commit cf42fa4

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed
16.1 KB
Loading

z indexing/index.html

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<style>
5+
/* Container for demonstration */
6+
.container {
7+
position: relative; /* Essential for positioning child elements */
8+
width: 300px;
9+
height: 200px;
10+
}
11+
12+
/* Element 1 */
13+
.element1 {
14+
position: absolute; /* Positioned absolutely within the container */
15+
width: 100px;
16+
height: 100px;
17+
background-color: #3498db; /* Blue */
18+
left: 50px;
19+
top: 50px;
20+
z-index: 1; /* Lowest z-index */
21+
}
22+
23+
/* Element 2 */
24+
.element2 {
25+
position: absolute;
26+
width: 100px;
27+
height: 100px;
28+
background-color: #e74c3c; /* Red */
29+
left: 100px;
30+
top: 100px;
31+
z-index: 2; /* Middle z-index */
32+
}
33+
34+
/* Element 3 */
35+
.element3 {
36+
position: absolute;
37+
width: 100px;
38+
height: 100px;
39+
background-color: #27ae60; /* Green */
40+
left: 150px;
41+
top: 150px;
42+
z-index: 3; /* Highest z-index */
43+
}
44+
</style>
45+
</head>
46+
<body>
47+
<div class="container">
48+
<!-- Element 1 (Blue) -->
49+
<div class="element1">1 (z-index: 1)</div>
50+
51+
<!-- Element 2 (Red) -->
52+
<div class="element2">2 (z-index: 2)</div>
53+
54+
<!-- Element 3 (Green) -->
55+
<div class="element3">3 (z-index: 3)</div>
56+
</div>
57+
</body>
58+
</html>

0 commit comments

Comments
 (0)