I’m going back through the Responsive Web Design cert and I have a question about something. When adding attributes to something (id, type, name, value) like an input tag, is there a specific meta to what order these attributes are added? As far as I understand, the order doesn’t affect the functionality, but it would be nice, for consistency’s sake, to follow what is most accepted.
AFAIK there is no ‘most accepted’ standard for ordering attributes. And you are correct, the order does not matter. Personally, I generally put the id first, followed by the class, and then the rest in whatever order I happen to add them. And I also find myself putting certain attributes before others, such as the type attribute for
<input> or the href attribute for
<a>. But I do not consider these rules written in stone and I don’t worry about it for the most part.
Programmers by nature like neat structured code and so I’m guessing many of us would suggest you be consistent in your ordering. There might be some benefit to this but I would certainly not penalize you for inconsistent attribute ordering. In order of importance, it is near the very bottom of my programming rules list (if it is even there at all).