suitcss / suit

Style tools for UI components
http://suitcss.github.io/
3.8k stars 229 forks source link

HTML example error: id which is numeric #128

Closed netsi1964 closed 8 years ago

netsi1964 commented 8 years ago

Love your work, but in https://github.com/suitcss/suit/blob/master/doc/STYLE.md you have an element with a numeric only id. That's not valid HTML, is it?

'<article class="Post" id="1234">'

simonsmith commented 8 years ago

It sure is:

There are no other restrictions on what form an ID can take; in particular, IDs can consist of just digits, start with a digit, start with an underscore, consist of just punctuation, etc.

https://www.w3.org/TR/html5/dom.html#the-id-attribute

CSS won't allow you to target an id beginning with a number, which may be what you're thinking of.

netsi1964 commented 8 years ago

Ok @simonsmith I see, the ID is an exception to the general attribute naming convension in HTML :-) The thing that using numeric only IDs makes it impossible to target it through a hash selector IMHO should also make one consider twice to do that :-) Thanks for replying.

simonsmith commented 8 years ago

Yeah, using id selectors in SUIT is a no-no so this should cause any issues.

One could also use an attribute selector:

[id='1234'] {
 /* does work */
}

Or just change the HTML :)

Thanks for your question though