At-rule clarification | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

At-rule clarification

Iā€™m having a hard time wrapping my head around at-rules. How are they different than rulesets? They seem to be the same.

29th Dec 2022, 12:35 AM
Brandon Harvey
Brandon Harvey - avatar
1 Answer
+ 4
At-rules, identified by the '@' symbol, are rules(or directives) that apply to the whole document, whereas rule sets apply to specific elements in the the document. For example: @font-face is used when defining a custom font which can be used for the entire document @import is used to import an external stylesheet to be used within the entire document All other rulesets, are standard rulesets which apply to SPECIFIC parts of the documents. For example: h1 { font-weight: bold; color: blue; } This ruleset will ONLY apply to h1 elements in the documents. So the difference between @ rules and standard rulesets is that @ rules are used to specify a rule/ directive that will apply to the whole document, whereas standard rulesets refer to specific elements in the document Hope this helps!
29th Dec 2022, 1:35 AM
Natan šŸ‡¹šŸ‡¹
Natan šŸ‡¹šŸ‡¹ - avatar