Technology News

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 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.

Direct Link →

5 Financial Technology (FinTech) Trends to Watch Out for B2B Companies
Deciding Your Web Design Priorities

Related Articles

Which MacBook Should You Buy In 2025? (Buyer’s Guide)

Which MacBook Should You Buy In 2025? (Buyer's Guide)
Use code LIAM to get $40 off when you choose your next MacBook: https://getupgraded.com/?utm_source=youtube&utm_content=may_liam There are so many different MacBooks available right now… But which one should you buy? Luckily…

Does Ukraine really need Elon Musk’s help?

does-ukraine-really-need-elon-musks-help
After Russia’s invasion, many feared Ukraine’s internet access would be cut off, either through cyberattacks or the destruction of internet infrastructure — or both. While there have been some temporary…

Think before you share

Think before you share
Your child already has a digital footprint—before they can even speak. But they didn’t create it. You did. Every photo you post, every milestone you share, helps train facial recognition…