Skip to content

Commit 13784f5

Browse files
committed
Selectors Re-Visited - :root pseudo-class Selector
1 parent d40a82f commit 13784f5

File tree

2 files changed

+23
-25
lines changed

2 files changed

+23
-25
lines changed

index.html

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,17 @@
1111
</head>
1212

1313
<body>
14-
<a href="#">general link</a>
15-
<a href="https://www.css3.com/">visited link</a>
16-
<a href="#">hover link</a>
17-
<a href="#">active link</a>
18-
<a>simple link</a>
14+
<h1 class="absolute">I'm absolute</h1>
15+
<h1 class="relative">I'm relative</h1>
16+
<p class="absolute">
17+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Accusamus
18+
sapiente porro nostrum incidunt molestias quia distinctio repellat ipsa.
19+
Quo, mollitia?
20+
</p>
21+
<p class="relative">
22+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Inventore
23+
temporibus iusto nesciunt unde laudantium nostrum, illo saepe pariatur
24+
facere optio?
25+
</p>
1926
</body>
2027
</html>

styles.css

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,20 @@
11
/*
2-
:link - unvisited links with href
3-
:visited - visited links
4-
:hover - hover
5-
:active - as the user click's
6-
a - all links
2+
:root root element of the document, higher specificity
3+
html element
4+
general styles
5+
css variables
76
*/
8-
a {
9-
display: block;
10-
background: yellow;
11-
margin-bottom: 0.5rem;
12-
padding: 0.5rem;
13-
}
147

15-
a:link {
16-
color: aqua;
8+
:root {
9+
font-size: 10px;
1710
}
1811

19-
a:visited {
12+
.absolute {
13+
font-size: 24px;
2014
color: red;
2115
}
2216

23-
a:hover {
24-
color: green;
25-
}
26-
27-
a:active {
28-
color: fuchsia;
17+
.relative {
18+
color: blue;
19+
font-size: 1.5rem;
2920
}

0 commit comments

Comments
 (0)