CSS Rules vs. CSS Rulesets

The latest spec:

A style rule is a qualified rule that associates a selector list with a list of property declarations and possibly a list of nested rules. They are also called rule sets in CSS2.

Louis Lazaris:

As the above quote from W3C indicates, it seems


CSS Rules vs. CSS Rulesets originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.


This content originally appeared on CSS-Tricks and was authored by Geoff Graham

The latest spec:

style rule is a qualified rule that associates a selector list with a list of property declarations and possibly a list of nested rules. They are also called rule sets in CSS2.

Louis Lazaris:

As the above quote from W3C indicates, it seems like the W3C considers “rule set” to be a bit of an outdated term, preferring the term “style rule” (or possibly “rule” for short).

I never noticed that! “Rule set” is so gosh darned branded on my brain that it’s gonan take losing a lot of muscle memory to start using “style rule” instead. I didn’t see a specific note in the spec’s Changes section, but you can see the change in the table of contents between versions:

Side-by-side screenshot comparing the table of contents for both the CSS 2 and CSS 3 specifications.

Louis nicely sums up the parts of a style rule as well:

/* Everything below is a style rule (or rule set, or just rule) */
section { /* Everything between the braces is a declaration block */
  margin: 0 20px; /* This line is an individual declaration */
  color: #888; /* Another declaration */
}

I know nothing of the context and, at first, I was gonna poo-poo the change, but “style rule” really makes sense the more I sit with it. If the property:value pairs are declarations that sit in a declaration block, then we’ve got something less like a set of rules and more like one rule that defines the styles for a selector with a block of style declarations. 👌

Once again, naming things is hard.

To Shared LinkPermalink on CSS-Tricks


CSS Rules vs. CSS Rulesets originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.


This content originally appeared on CSS-Tricks and was authored by Geoff Graham


Print Share Comment Cite Upload Translate Updates
APA

Geoff Graham | Sciencx (2022-09-21T21:53:44+00:00) CSS Rules vs. CSS Rulesets. Retrieved from https://www.scien.cx/2022/09/21/css-rules-vs-css-rulesets-2/

MLA
" » CSS Rules vs. CSS Rulesets." Geoff Graham | Sciencx - Wednesday September 21, 2022, https://www.scien.cx/2022/09/21/css-rules-vs-css-rulesets-2/
HARVARD
Geoff Graham | Sciencx Wednesday September 21, 2022 » CSS Rules vs. CSS Rulesets., viewed ,<https://www.scien.cx/2022/09/21/css-rules-vs-css-rulesets-2/>
VANCOUVER
Geoff Graham | Sciencx - » CSS Rules vs. CSS Rulesets. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/09/21/css-rules-vs-css-rulesets-2/
CHICAGO
" » CSS Rules vs. CSS Rulesets." Geoff Graham | Sciencx - Accessed . https://www.scien.cx/2022/09/21/css-rules-vs-css-rulesets-2/
IEEE
" » CSS Rules vs. CSS Rulesets." Geoff Graham | Sciencx [Online]. Available: https://www.scien.cx/2022/09/21/css-rules-vs-css-rulesets-2/. [Accessed: ]
rf:citation
» CSS Rules vs. CSS Rulesets | Geoff Graham | Sciencx | https://www.scien.cx/2022/09/21/css-rules-vs-css-rulesets-2/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.