Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

css name should be?

Tags:

html

css

seo

i am making style sheet for a website. css style name should be related to website or content?

my website is about web development.is that right to use style name-

#web-development-header

.web-development-company-london-content

or should use

#header
.content

is css style name can help for seo?

like image 826
Kali Charan Rajput Avatar asked Jun 02 '10 13:06

Kali Charan Rajput


People also ask

What characters are allowed in CSS names?

In CSS, identifiers (including element names, classes, and IDs in selectors) can contain only the characters [a-zA-Z0-9] and ISO 10646 characters U+00A0 and higher, plus the hyphen (-) and the underscore (_); they cannot start with a digit, two hyphens, or a hyphen followed by a digit.

Does class name matter in CSS?

No, it does not.


Video Answer


3 Answers

Go for content related names - those would be easy to maintain. Longer strings mean longer time to load the page. And CSS style names have nothing to do with SEO.

like image 180
Amarghosh Avatar answered Sep 16 '22 18:09

Amarghosh


Choose the content naming convention.

One piece of advice, use names that do not describe visual output because visual output may change and then the CSS class or id name is misleading.

For example, if .redtext changes to blue by the designers, then the class name is misleading and the effort to find and replace is laborious.

I recommend choosing names like .warningtext rather than .redtext.

like image 33
Christopher Altman Avatar answered Sep 16 '22 18:09

Christopher Altman


While at the moment you're building a site for a web development company in london, what happens when you want to reuse the code for a web development company in new york? or what about a craft store in london? It seems trivial now, since you're writing the code, but what if you've got a team? The best practice is to use names that make sense to the page at hand. If you bring the page up on the screen, anybody should be able to identify major components: header, footer, navigation, etc., etc.

While IDs and classes should be descriptive like Christoper Altman posted (.warningtext v .redtext) there's no need to overload them with information (.thisTextAppearsWhenTheUserEntersTheirNameInThePhoneNumberArea is a bit silly) so there's a balance to be struck. Generally as a rule, I try to use the minimum description to specifically tag a section, both to simplifiy my codes appearance and my unhealthy obsession with speed.

In short, if all you need to correctly ID a section is header, then use header. No need to introduce more information if it doesn't have a purpose.

like image 38
Alex Larzelere Avatar answered Sep 17 '22 18:09

Alex Larzelere