A quick note about HTML IDs. A lot of people don’t realise that the main point in IDs in HTML documents is to uniquely identify an element within the page. That means that you really shouldn’t have multiple elements with the same ID. Whilst most modern browsers are fine with you doing it, it can cause problems when you try to access the object via javascript, and there is always a possibility that it will trigger off some unknown browser bug that will crash the browser. Also, if you want your site to pass validation, make sure you avoid this problem.
The correct thing to do, should you need to have multiple items on a page with the same styles, is to use a CSS Class.
No related posts.
Tags: CSS, HTML, Standards Compliance











