-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSelSpec.html
167 lines (143 loc) · 5.09 KB
/
SelSpec.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
<DOCTYPE html>
<head>
<title>CSS Selectificity</title>
<link href="SelectorsAndSpecificity/SSStyle.css" type="text/css" rel="stylesheet">
</head>
<body style="background-color: rgba(255, 233, 14, .45)">
<div ID = "intro">
<!--NOTICE ME BABY-->
<!--Okay now that you're listening, here is the element with the tag 'Top'-->
<!--This tag is used by two links (atm), the one in the TOC and the one at the bottom of this page that says "Return to Top"-->
<!--IDs are super cool because they can be used multiple times. Just make sure that multiple elements dont have the same ID if you are planning to use the ID for a hyperlink, as if two different elements had the ID 'Top' on the same page then you wouldn't get the desired functionality-->
<h1 id = "Top">CSS selectors and specificity</h1>
<p>This page is an exploration of CSS selectors and their varying specificities</p>
<p class= "firstAttempt">this is my first attempt to append a class to a paragraph</p>
<p class = "firstAttempt secondAttempt">This is my first attempt to appeand a second class</p>
</div>
<h2 class = "alignLeft">This is h2.1</h2>
<p class = "alignLeft">
This is the paragraph that follows h2.1
<br>
This, and its heading, have been aligned left with the class "alignLeft"
</p>
<h3 class = "alignRight">This is h3.1</h3>
<p class = "alignRight">
This is the paragraph that follows h3.1
<br>
This, and its heading, have been aligned right with the class "alignRight"
</p>
<h4 class = "alignCenter">This is h4.1</h4>
<p class = "alignCenter">
This is the paragraph that follows h4.1
<br>
This, and its heading, have been aligned center with the class "alignCenter"
</p>
<br><br><br><br>
<table>
<thead>
<tr>
<th scope="col">CSS Selector</th>
<th scope="col">Function/Specificity</th>
</tr>
</thead>
<tbody>
<tr>
<td rowspan="2">Class</td>
<td>Specificity 1: Overriden by any other selector</td>
</tr>
<tr>
<td>Used to apply CSS elements in very broad cases</td>
</tr>
<tr>
<td rowspan="2">Tag</td>
<td>
Specificity 2: Overriden by everything but Class
</td>
</tr>
<tr>
<td>
Used to apply CSS elements over a specific set of broad cases
</td>
</tr>
<tr>
<td>ID</td>
<td>
Specificity 3: Overrides all selectors but !Important
<br>
Used to apply CSS elements to specific items
</td>
</tr>
<tr>
<td>!Important</td>
<td>
Specificity 1: Overrides any other selector, cannot be overriden
<br>
Used to apply CSS elements that should NEVER be overriden, only used in special cases
</td>
</tr>
</tbody>
<tfoot>
</tfoot>
</table>
<br><br><br>
<h2>
<p>
The Point
<br><br><br>
Of This
<br><br><br>
Text
<br><br><br>
Is To
<br><br><br>
Take
<br><br><br>
Up
<br><br><br>
Space
<br><br><br><br>
</p>
</h2>
<div id = "Bottom"></div>
<a href = "#Top">Return to Top</a>
<div>
<link href="SideBar.css" type="text/css" rel="stylesheet">
<nav class="main-menu">
<ul>
<li>
<a href="SelSpec.html#Top">
<i class="fa fa-home fa-2x"></i>
<span class="nav-text">
CSS Selectors and Specificity: Top of Page
</span>
</a>
</li>
<li>
<a href="SelSpec.html#Bottom">
<i class="fa fa-home fa-2x"></i>
<span class="nav-text">
CSS Selectors and Specificity: Bottom of Page
</span>
</a>
</li>
<li>
<a href="TOC.html#">
<i class="fa fa-home fa-2x"></i>
<span class="nav-text">
TOC
</span>
</a>
</li>
<li>
<a href="ListRand.html#">
<i class="fa fa-home fa-2x"></i>
<span class="nav-text">
List Randomizer!
</span>
</a>
</li>
</ul>
</nav>
</div>
</body>
</DOCTYPE>