which is better to use "id=" or "ul=" ??????????????????????
I have been using elance contracts to design the more complex css elements of my website (the simple stuff I can do) and am a bit perplexed by one question.
Every contractor uses something like this:
And not something like this:
I thought that an "id=" cannot be attached to the same css rule more than once on the same page due to stability issues. For example, you could only use id="navbar" once on the same page, but could use class="navbar" repeatedly on the same page.
Thus, I have been switching the id="navbar" to class="navbar". Both seem to work and using class="navbar" means I can use a css rule repeatedly on the same page and not have to create two css rules that are the same but with different names to use them on the same page - reducing my css file size.
But the fact the elance contractors, who know more about css than me, are all using "id=" causes me to question is they are doing so for a good reason. Does anybody know the anwser?
// function to make the button submit the payment
I would not want to use the class because it would execute this function for all elements with the button class. For example:
// cannot put the submit payment stuff here
I'm always up for networking with fellow web professionals. Connect with me on LinkedIn if you like!
I totally agree with your usage, an ID should be used only once a page (cause if you call something by it's ID you want that one specific item you identified with your ID to answer) and class can be used more often (although you can also use it once).
On the other hand, why would you want to use a navbar more than once on the page?