-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path13-Pseudo-classes-and-elements.html
231 lines (200 loc) · 5.12 KB
/
13-Pseudo-classes-and-elements.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
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
<!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>CSS Concept : Pseudo Classes and Elements</title>
</head>
<style>
body {
background-color: antiquewhite;
}
h1 {
color: brown;
}
h2 {
color: green;
}
h3 {
color: blueviolet;
}
hr {
height: 5px;
background-color: black;
border-radius: 10px;
}
/* unvisited link */
a:link {
color: red;
}
/* visited link */
a:visited {
color: olive;
}
/* mouse over link */
a:hover {
color: green;
}
/* selected link */
a:active {
color: blue;
}
.tooltip-text {
display: none;
background-color: aquamarine;
padding: 20px;
}
.tooltip:hover .tooltip-text {
display: block;
}
.first-child p:first-child {
color: red;
}
/* Pseudo Elements */
/* First Line */
.first-line::first-line {
color: red;
font-variant: small-caps;
font-size: large;
}
/* First Letter */
.first-letter::first-letter {
color: blue;
font-size: xx-large;
}
/* Before */
.before::before {
content: "Before";
color: orangered;
font-size: x-large;
}
/* After */
.after::after{
content: "After";
color: maroon;
font-size: x-large;
}
/* Marker */
::marker{
color: hotpink;
font-size: x-large;
}
/* Selection */
::selection{
color: black;
background-color: gold;
}
/* Placeholder */
::placeholder{
color: red;
font-size: large;
}
/* Spelling Error */
::spelling-error{
text-decoration: wavy rebeccapurple;
}
</style>
<body>
<h1>Pseudo Classes and Elements</h1>
<h2>Anchor Pseudo Class</h2>
<p>
<b><a href="default.asp" target="_blank">This is a link</a></b>
</p>
<p>
<b>Note:</b> a:hover MUST come after a:link and a:visited in the CSS
definition in order to be effective.
</p>
<p>
<b>Note:</b> a:active MUST come after a:hover in the CSS definition in
order to be effective.
</p>
<hr />
<h2>Simple Tooltip Hover</h2>
<div class="tooltip">
Hover over this div element to show the p element
<p class="tooltip-text">Tada! Here I am!</p>
</div>
<hr />
<h2>First Child</h2>
<div class="first-child">
<p>First Paragraph</p>
<p>Second Paragraph</p>
<p>Third Paragraph</p>
<div>
<p>First Paragraph</p>
<p>Second Paragraph</p>
<p>Third Paragraph</p>
</div>
</div>
<hr />
<hr>
<h1>Pseudo Elements</h2>
<h2>First Line</h2>
<p class="first-line">
The ::first-line pseudo-element is used to add a special style to the
first line of a text.
Lorem ipsum dolor sit amet consectetur adipisicing elit. Ut nam natus possimus suscipit optio ratione laudantium maiores obcaecati nihil nobis tenetur, quaerat dignissimos nulla animi saepe voluptatum architecto, atque adipisci!
Maxime iusto tempora tempore voluptatibus ducimus pariatur nulla alias quas dolores velit unde in voluptatem corrupti nihil nostrum odit doloremque, necessitatibus sunt provident? Aspernatur iure maxime iusto velit, unde aliquam.
Laborum, nulla doloribus nam earum repellendus eveniet consectetur esse, perferendis fugit quas at placeat animi assumenda deserunt commodi reiciendis voluptatibus cupiditate quis sint incidunt voluptate aspernatur. Accusamus amet atque ipsam!
</p>
<hr>
<h2>First Letter</h2>
<p class="first-letter">
The ::first-letter pseudo-element is used to add a special style to the
first letter of a text.
</p>
<hr>
<h2>Before</h2>
<p class="before">
The ::before pseudo-element can be used to insert some content before the
content of an element.
</p>
<hr>
<h2>After</h2>
<p class="after">
The ::after pseudo-element can be used to insert some content after the
content of an element.
</p>
<hr>
<h2>Marker</h2>
<p>
The ::marker pseudo-element can be used to style the bullet of a list
</p>
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
</ul>
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
</ol>
<hr>
<h2 >Selection</h2>
<p class="selection">
The ::selection pseudo-element matches the portion of an element that is
selected by a user.
</p>
<hr>
<h2>Placeholder</h2>
<input type="text" placeholder="Type Name">
<hr>
<h2>Spelling</h2>
<p contenteditable spellcheck="true">
My friends are coegdfgfddffbgning amd to the party tonight.
</p>
<hr>
</body>
</html>