Skip to content

Commit 12afeb5

Browse files
committed
feat: pseudo elements
1 parent b801a64 commit 12afeb5

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

starter/03-CSS-Fundamentals/style.css

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,3 +244,46 @@ button {
244244
bottom: 50px;
245245
right: 50px;
246246
}
247+
248+
/* * Pseudo Element (use double colon "::" */
249+
h1::first-letter {
250+
font-style: normal;
251+
margin-right: 5px;
252+
}
253+
254+
/* p::first-line {
255+
color: red;
256+
} */
257+
258+
/* * Adjacent sibling selector:
259+
* is the selector of the element that share the same parent.
260+
*/
261+
h3 + p::first-line {
262+
color: red;
263+
}
264+
265+
h2 {
266+
/* background-color: orange; */
267+
position: relative;
268+
}
269+
270+
/* * Pseudo element: first child element of the parent "h2" */
271+
h2::before {
272+
}
273+
274+
/* * Pseudo element: last child element of the parent "h2" */
275+
h2::after {
276+
content: "TOP";
277+
background-color: #ffe70e;
278+
color: #444;
279+
font-size: 16px;
280+
font-weight: bold;
281+
display: inline-block;
282+
padding: 5px 10px;
283+
position: absolute;
284+
/* * Negative Length:
285+
* It will move to the opposite direction of specify attributes.
286+
* */
287+
top: -10px;
288+
right: -25px;
289+
}

0 commit comments

Comments
 (0)