Solidariti
Solidariti

Reputation: 475

CSS naming guidelines

I was reading this:

"Guideline Number 7: Try to avoid using unecessary classes and IDs.

So, now that we’re keeping our hooks to a minimum, it’s time for our next step in quality over quantity: naming. We want to avoid names that imply presentational aspects. Otherwise, if we name something right-col, it’s entirely possible that the CSS would change and our “right-col” would end up actually being displayed on the left side of our page. That could lead to some confusion in the future, so it’s best that we avoid these types of presentational naming schemes."

So what do I call them if not right-col and not presentational?!?!

Upvotes: 0

Views: 352

Answers (6)

Henry Ruhs
Henry Ruhs

Reputation: 1630

NCSS Sheets is a naming convention and guideline for semantic CSS: CSS class naming convention

Upvotes: 0

kobe
kobe

Reputation: 15835

As long as it conveys meaning for the html structure and other developers can understand well it should be fine.

Upvotes: 1

David Thomas
David Thomas

Reputation: 253308

Rather than naming things after their presentation name them for their function, or purpose. Also, try to use a coherent page structure so far as possible, and use the CSS cascade to access/target elements.

Upvotes: 1

Eric Fortis
Eric Fortis

Reputation: 17350

check out 960.gs using that gridsystem will save a lot of time, trying to figure out the best naming scheme.

Upvotes: 0

Phrogz
Phrogz

Reputation: 303188

I discuss this very topic in "How to Develop with CSS". What you call it depends on the content. Maybe "sidebar" or "links" or "extra".

Upvotes: 1

Sotiris
Sotiris

Reputation: 40046

any naming technique has advantages and disadvantages...try to find a way that help you more in your work, and make well commented css files.

Upvotes: 1

Related Questions