-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpseudo.css
59 lines (58 loc) · 926 Bytes
/
pseudo.css
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
53
54
55
56
57
58
59
/*
pseudo elements ::before ::after CONTENT not element
content: '' -- required
img --- does not work
*/
p::before {
content: "Hello";
display: block;
background: burlywood;
font-weight: bold;
font-size: 2rem;
color: rebeccapurple;
}
p::after {
content: "";
display: block;
width: 50px;
height: 50px;
background: grey;
}
div {
width: 50vw;
margin: 100px auto;
position: relative;
}
img {
width: 100%;
display: block;
}
div::before {
content: "";
border: 2px solid grey;
width: 100%;
height: 100%;
position: absolute;
box-sizing: border-box;
top: -40px;
left: 40px;
z-index: -2;
transition: all 0.5s linear;
}
div::after {
content: "";
background: gray;
width: 100%;
height: 100%;
position: absolute;
box-sizing: border-box;
top: -20px;
left: 20px;
z-index: -1;
transition: all 0.5s linear;
}
div:hover::after,
div:hover::before {
top: 0;
left: 0;
}