IDs and Classes in CSS

Submitted by james_admin_2018 on Tue, 10/27/2009 - 14:22

The ID attribute is used to uniquely identify a particular tag (& it's contents) on a HTML page. Once a tag has an ID we can apply CSS styling specifically to that tag (& it's contents). This is useful to prevent the use of deprecated tags (<center>, <font>, <b>, <u>, <i>, <strong>, <hn>, etc). Let's take an example to demonstrate what I mean: a simple page with a heading of "Hello World!!" that we want as centred bold piece of text in large font, followed by a paragraph saying "Welcome to my first webpage." which we want right aligned.