Jump to content

Topic on Talk:Requests for comment/Scoping site CSS

Nemo bis (talkcontribs)

vector: Apply content text style via .mw-body-content instead of #bodyContent was just merged and claims «The use of classes for content styling has been recommended and generally agreed upon, specifically in the context of the RFC about scoping site CSS» in order to «finally liberate content styles from the notion of a singular body div on a pag». Reviewers pointed out some possible side effects, they may want to elaborate.

However, the RFC doesn't say anything about this yet, can it be updated? Can the alleged problem can be solved "simply" by using classes more? It's been a MediaWiki development mantra for a while to always put new stuff in a class so that it can easily be overridden (also on wiki) and reused.

Krinkle (talkcontribs)

To clarify, the commit message was just saying that one should use classes instead of IDs. That's not even remotely a proposal or worthy to write an RFC about, but a simple state of fact about writing proper CSS. Using IDs in CSS is exclusively bad practice. Sometimes out of laziness we use an ID, but it would always be an improvement to replace or supplement an ID with a class.

Find me one case where an ID is better, and I'll proof you wrong :)

As for this RFC (scoping of CSS), scoping is hard or difficult regardless of whether one uses IDs or classes. It might be slightly easier to scope things with classes, but it's mostly unrelated. I'm not sure why this RFC was mentioned in the second sentence you cited.

Reply to "Using classes more"