Another way of restricting which tags a particular style is to apply to is by using an id attribute on a tag.
Where this differs from using a class attribute is that there can be only one tag on your web page that has a particular id value. Each id that you specify on the page must be unique. This makes the id attribute the ideal one to use when you want to use styles to define the position in the page or browser window where the particular object is to be displayed using stylesheet positioning commands (which we will get to in a later tutorial).
The styles for an id are defined the same way as for tags and classes except that the tag and/or class on the front of the definition is replaced with the id. To identify the reference as an id instead of a tag or class the id is preceded by a # like this:
Since ids are by definition unique, there is almost never a need to further qualify a style that applies to an id as it is already limited to a particular single tag on the page. The only time that further qualifying the style to apply to an id in the page might be necessary would be if the same id is used in multiple pages and you only want the style to apply on some of those pages.
This article written by Stephen Chapman, Felgall Pty Ltd.