-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path17-Pseudo Elements (before & after).html
More file actions
96 lines (85 loc) · 1.96 KB
/
17-Pseudo Elements (before & after).html
File metadata and controls
96 lines (85 loc) · 1.96 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>17 - Pseudo Elements (before & after)</title>
<style>
/* Reset default browser styles */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
/* Decorative underline using ::after */
h2::after {
content: "";
display: block;
width: 60px;
height: 4px;
background: crimson;
margin-top: 8px;
}
/* Card container */
.card {
position: relative;
width: 200px;
height: 120px;
margin: 30px 0;
background: #f4f4f4;
}
/* Decorative circle on card */
.card::before {
content: "";
width: 40px;
height: 40px;
background: teal;
border-radius: 50%;
position: absolute;
top: 20px;
left: 20px;
}
/* Icon container */
.icon {
position: relative;
width: 60px;
height: 60px;
background: #ddd;
margin-top: 20px;
}
/* Notification badge using ::after */
.icon::after {
content: "3";
position: absolute;
top: 6px;
right: 6px;
background: red;
color: white;
font-size: 15px;
padding: 4px 6px;
border-radius: 50%;
}
/* Highlighted text */
.highlight {
position: relative;
z-index: 1;
}
/* Highlight background using ::before */
.highlight::before {
content: "";
position: absolute;
width: 100%;
height: 40px;
background: yellow;
left: 0;
bottom: 0;
z-index: -1;
}
</style>
</head>
<body>
<h2>Pseudo <span class="highlight">Elements</span> Explained</h2>
<div class="card"></div>
<div class="icon"></div>
</body>
</html>