views:

429

answers:

7

hi when i write css or html i found that i want add two name like this

web-development
web_development

which one is better according SEO or write style name, file name or image name.

+10  A: 

use the dash. Google engines don't really parse underscores. This is maybe for programmers sanity, so that when they search for query_function, they get results they are looking for?

If you have a url like "http://example.com/web-site", google will return results for 'web', 'site' and '"web site"'. This is not the case for underscores: web_site will only return results for web_site.

ps. I also think that dashes are better than underscores for usability purposes: a dash is a single button on the keyboard, while an underscore requires two buttons to be pressed. This has nothing to do with the technical side of SEO, but everything to do with usability, which is more important than SEO imo.

superUntitled
Agree with using the dashes instead of underscores. Sure just look at the URL of this question, you've got to trust what SO chose :)
Alb
@Alb: I don't agree with “you've got to trust what SO chose”. This site itself is not the ‘highest authority’ you can find. I think you should always take the source of the message into account and I trust assertions about Google more from the mouth of Matt Cutts than from the things SO practices.
Marcel Korpel
+13  A: 

The first one is better. Also see this post by Google employee Matt Cutts: http://www.mattcutts.com/blog/dashes-vs-underscores/

Emil Vikström
That is an old post. I read somewhere (I wish I remembered where) that now, at least for Google, it doesn't matter any more. But it may make a difference with other indexers. But Emil's answer is still correct.
Echo
It's an old post indeed. They talked about changing this in 2007 but I don't know if they've taken the changes live or not. This is still the last (semi-)official post about it from Google so I can't think of any good reason not to follow it.
Emil Vikström
@Emil: Yup, dashes also look nicer I think.
Echo
+2  A: 

Isn't it common practice to use the - to connect two words, and the _ to replace a space in situations where you can't use a space/+ sign, like CSS classNames?

CharlesLeaf
Not the last part, no. CSS class names vary wildly. From my observation, dashes have prominence pure and simple.
D_N
A: 
  1. Please list two (2) words in the English language that use underscores ("_") within them.
  2. Now list fifty (50) words that use dashes/hyphens ("-").

My opinion is that the hyphens would be a better solution for SEO.

IMO When it comes down to SEO is that everything makes a difference !

RobertPitt
A: 

You are dealing with two different problems: URLs and CSS. For URLs, hyphens would be the better choice because of SEO.

However, depending on your editing program, underscores might work better for mutli-word class names. In TextMate for instance, I can hit Esc to finish (auto-complete) a class I previously entered. It stops completing when it encounters a hyphen, but will fill in the whole class name when you use an underscore. If this is not the case for your editor, then it is really up to your preference.

Doug Neiner
Wrong. Google specifically says they don't care, at least in the URI. If SEO wants to fight underscores in HTML then they are fighting standard markup and the W3C and that would be stupid. HTML and CSS are markup languages and search engines will not penalize you for proper use of standard markup.
Rob
@Rob, ha! I totally wrote the wrong thing. I meant URLs and CSS not HTML/CSS... updating my answer now... doh!
Doug Neiner
+2  A: 

for css i don't think there is some issues with naming methodology, but for naming HTML pages - is preferred as search engines take - as space, even though good page name is not enough for good s.e.o. you need to have proper meta tag and keywords.

And make sure all your images have proper title tag, this is real essential.

Ashish Rajan
+1  A: 

first one is better in terms of SEO. Because the priority of hiphen is greater than under score

Badshah