-
Notifications
You must be signed in to change notification settings - Fork 0
/
22.html
52 lines (48 loc) · 1.43 KB
/
22.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Visibility and z-index</title>
<style>
.square{
/* border: 2px solid black; */
width: 100px;
height: 100px;
}
#sq1{
background-color: blue;
position: relative;
top: 19px;
/* z-index doesnt work with static positioning */
z-index: -30;
}
#sq2{
position:relative;
top: 14px;
z-index: 122;
background-color: red;
/* Default value is visibility: visible*/
/* visibility: hidden; */
/* display: none; */
/* display: none vs visibility: hidden */
/* display will entire remove the element whereas visibility will only hide it and its empty space will be visible */
}
#sq3{
background-color: green;
}
#sq4{
background-color: yellow;
}
</style>
</head>
<body>
<div class="square">
<div class="square" id="sq1"></div>
<div class="square" id="sq2"></div>
<div class="square" id="sq3"></div>
<div class="square" id="sq4"></div>
</div>
</body>
</html>