@@ -178,7 +178,7 @@ <h2 class="chapter-heading">Ch. 26 Class and ID Selectors</h2>
178
178
By adding class and id attributes to elements, class and ID selectors
179
179
can be supplied for a CSS rule.
180
180
</ p >
181
- < p > An id attribute value may only be used once .</ p >
181
+ < p > An ID may only appear once within the html code, whereas a class may appear any number of times .</ p >
182
182
< p >
183
183
It is a standard convention for classes and IDs comprising of multiple
184
184
words to be strung together by using dashes.
@@ -187,6 +187,43 @@ <h2 class="chapter-heading">Ch. 26 Class and ID Selectors</h2>
187
187
If multiple CSS rules apply to the same element, then technically they
188
188
all apply (more later).
189
189
</ p >
190
+ < section class ="chapter-sub-section ">
191
+ < h3 class ="chapter-sub-section-heading "> Examples</ h3 >
192
+ < article class ="chapter-sub-section ">
193
+ < h4 class ="chapter-sub-section-heading "> ID Selector</ h4 >
194
+ < div class ="chapter-sub-section ">
195
+ < h5 class ="chapter-sub-section-heading "> style.css</ h5 >
196
+ < code >
197
+ < pre > #author {
198
+ ...
199
+ }</ pre >
200
+ </ code >
201
+ </ div >
202
+ < div class ="chapter-sub-section ">
203
+ < h5 class ="chapter-sub-section-heading "> index.html</ h5 >
204
+ < code > < pre > <p id="author">...</p></ pre > </ code >
205
+ </ div >
206
+ </ article >
207
+ < article class ="chapter-sub-section ">
208
+ < h4 class ="chapter-sub-section-heading "> Class Selector</ h4 >
209
+ < div class ="chapter-sub-section ">
210
+ < h5 class ="chapter-sub-section-heading "> style.css</ h5 >
211
+ < code >
212
+ < pre > .author {
213
+ ...
214
+ }</ pre >
215
+ </ code >
216
+ </ div >
217
+ < div class ="chapter-sub-section ">
218
+ < h5 class ="chapter-sub-section-heading "> index.html</ h5 >
219
+ < code >
220
+ < pre > <p class="author">...</p>
221
+ <p class="author">...</p>
222
+ </ pre >
223
+ </ code >
224
+ </ div >
225
+ </ article >
226
+ </ section >
190
227
</ section >
191
228
< article class ="chapter-sub-section ">
192
229
< h3 class ="chapter-sub-section-heading "> Why use classes over IDs?</ h3 >
0 commit comments