Why is "lowercase with dash" the standard for HTML classes?

Possible duplicate:
Why are dashes preferred for CSS selectors / HTML attributes?

Personally, I use "lowercase with dash" to format my HTML classes, which seems to be the standard these days. Using something like the camel case seems to be more restrained for JavaScript in my eyes, but I understand that only my opinion.

I am trying to improve the consistency of code in my workplace and part of this will be a coding guide. Rather than just saying β€œwe have to do it this way,” I really want to hear some good reasons for this general trend.

So the question in general is, what are some valid technical reasons for the "lowercase with dash" trend for HTML classes?


source to share

3 answers

As you mentioned in your own question but I realise that just my opinion


Coding conventions:

  • rules for reading code (number of spaces for identification, naming of variables, ..)
  • is in no way a limit in your coding
  • for each language

In short, this is just a suggested coding way that you don't need to follow, but it is more readable for other people if you do.

If you come across one set of conventions, it means that many people agree with this set and accept it for themselves (with or without some changes =))

Some languages ​​limit conventions a bit (for example, class names must start with a capital letter, ..), so it differs for different languages.



Not. This is an acceptable naming convention to help the author confuse different languages. You can name the class names in any way you want.



Coding conventions are just: conventions.

What is a convention? Usually, do something?

Why is that? Because someone said it.



All Articles