homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: not2easy

CSS Forum

naming of class names and ids - does it matter?

10+ Year Member

Msg#: 4451500 posted 7:49 pm on May 9, 2012 (gmt 0)

With all the latest changes with Google I have been thinking somewhat out-of-the-box from how I've been doing things.

This question popped in my head today... 'does google care what you name your classes and id's in your css?'

Me personally I usually use names like logomain,logosub, leftcontent, rightcontent, footer, blue16, etc... would there be any difference if these were something like :

blue-16, left-content, widget-logo, etc?

If you think about it... eventhough your styling is in the css these classes and id's are used in the actual html of the page.

One would think these words would be parsed OR are they filtered out because they are indeed classes and id's and the crawler knows that? Opinions?



WebmasterWorld Senior Member g1smd us a WebmasterWorld Top Contributor of All Time 10+ Year Member

Msg#: 4451500 posted 7:51 pm on May 9, 2012 (gmt 0)

Cetainly name them as what they are for or what they do, rather than what they look like.

e.g. "warning" rather than "red-text".

Hyphen-separators, underscores, camelCaps, I don't think it matters all that much. Just be consistent.


10+ Year Member

Msg#: 4451500 posted 8:10 pm on May 9, 2012 (gmt 0)

I was looking for any reason to be more 'clean' in terms of seo... does it even matter? I'm not too concerned if someone else understands my naming conventions.


WebmasterWorld Senior Member 5+ Year Member

Msg#: 4451500 posted 9:03 pm on May 9, 2012 (gmt 0)

Hi mihomes, I understand you are wanting to know if class/id names in the document affect SEO, rather than discuss class/id naming conventions. That said, I'll still second g1smd's advice to name for function not form, and to use naming conventions that are intuitively obvious to others - you just never know what the future holds.

To my knowledge, as we speak there is no known connection between seo benefits and class/id names. An obvious reason would be rewarding (and therefore encouraging) multiple nested id-ed elements with multiple class names.

That would directly defeat g*'s claim to be working to improve coding standards - so I'm wondering what "changes" prompted your question.

That said, has anyone ever done any tests like:
(a) Using self-evidently unacceptable id/class names (eg, obscenities, or words that would trigger most word filters)
(b) Stuffing the :before/:after pseudo elements and styling them off the page.

Note, not suggesting these things - wondering if anyone ever tested the impact.


10+ Year Member

Msg#: 4451500 posted 9:46 pm on May 9, 2012 (gmt 0)

I was simply referring to the new algo updates and what not. We all know Google is constantly changing their algo. What actually prompted the question was I had been making some changes to my css file and noticed one that I did not remember what it was for (did not describe it properly as I was probably working fast).

Of course, I realize the benefit of clean css names (it would have eliminated the above problem), but I was wondering if there was any seo benefit out of it. I have always made names as small as possible while still having a good idea what they are.


WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month

Msg#: 4451500 posted 11:26 pm on May 9, 2012 (gmt 0)

use naming conventions that are intuitively obvious to others

Where "others" includes
:: cough-cough ::
yourself next year when you look at your code trying to figure out what it does. ("What was I thinking?")

I once processed an ebook whose creator named all his css classes in Esperanto. Let's hope no future user ever needs to edit it :)


WebmasterWorld Senior Member rocknbil us a WebmasterWorld Top Contributor of All Time 10+ Year Member

Msg#: 4451500 posted 4:20 pm on May 10, 2012 (gmt 0)

<focus, just SEO, just SEO . . . >

Off the top of my head the only place I can think of that ID's or classes might be relevant is in the use of microformats, and even then, only indirectly. Microformats are often used by some services (local listings come to mind) and if your site does well in those services due to proper use of microformats, then that site will likely lend you link juice that will help your overall results.


Msg#: 4451500 posted 1:15 pm on May 28, 2012 (gmt 0)

I have heard rumours that Google at some point did pick up on things like id="footer", when they first started evaluating content based on page context (the 'intelligent surfer' model). But I think that their algorithms are likely sophisticated enough now to determine the relative significance of regions of a page without such cues.

However, semantic naming in markup is always a good thing in my book and is part of what HTML5 is aiming to achieve with elements like <article> and <aside>.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved