Question is in the title. I'm used to using camelcase in development and, since there are crossovers with design, was wondering if there are any technical reasons (regardless of opinions) against using it in HTML. Thanks in advance for your replies.
For SEO (read as: the way Google does things), URL path names should be kebab-case.
The CSS id Selector To select an element with a specific id, write a hash (#) character, followed by the id of the element.
Meaning of camel case in English. the use of a capital letter to begin the second word in a compound name or phrase, when it is not separated from the first word by a space: Examples of camel case include "iPod" and "GaGa".
Always favor lowercase, for elements, for attributes and their values, for classes and ids. Multi-word names for classes and ids should either 1., concatenate the words in lowercase without any in-between character, or 2., separate each word with a "-" (not "_") and maintain lowercasing throughout.
There is one technical limitation if you use camelCase identifiers in your CSS - the |=
selector specifier:
<form class="registration"></form>
<form class="search-movies"></form>
<form class="search-actress"></form>
To match only search forms, you can write:
[class|="search"] { font-size: 150% }
You cannot do this with camelCase class names.
Technically, no, there are no technical issues. Do what you like.
Do try to follow a good style-guide though, like this one.
I'd been using camelCasing before today, let me tell the story: I created a bootstrap modal by the id name written in camelCasing. I couldn't manipulate it using bootstrap's own JQuery function. After searching for days, finally my co-worker found out that camelCasing was causing it. JavaScript case sensitivity can be tricky and unpredictable. So I suggest you to use hyphens.
Good question. I personally use camelCase in class/id names.There is no technical reason why you can't.
However, after doing some quick reading on opinions, it seems alot of other developers/designers use hyphens over camelCase due to better readability.
Go with what you are comfortable coding in. I have got by fine using camelCase, I work in a team environment and never had an issue with readability for other developers.
Opinions on this that I have been reading can be found here: http://css-tricks.com/new-poll-hyphens-or-dashes/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With