Elements in an HTML document such as text, headings, and table and figure numbers include information about font, color, and format that determine appearance. The style sheet is allows a variety of factors in an HTML document to be set.
Set the style for an HTML tag If you directly change the style of an element (for example, main body <BODY>, paragraph <P>, headings <H1> to <H6>) in an HTML document, the appearance of all occurrences of that element in the HTML document can be changed. If you set the color of heading <H1> to red, all <H1> headings in the HTML document are displayed in red. If you set the font size of the paragraph <P> to 12 points, all paragraphs <P> in the HTML document are displayed with a 12-point font.
Set a style for a Class A style can be defined for any unique name. By setting class attributes for the names of the elements in an HTML document, the appearance of these elements can be changed. That is, the style of all portions whose names are used as class attributes in the HTML document is changed.
Set an ID for the style A style can also be assigned an ID attribute in an HTML document. Since each attribute have only one ID attribute name in a document, only one style can be applied from one ID attribute within the same document.
External style sheet A Style Definition can be created as another file, not only as an HTML document. If you create the style definition in an external style sheet and link or import it to the HTML document, you can use the style definition in the external style sheet for the HTML document. If you use the same external style sheet for multiple HTML documents, you will have a consistent style across multiple HTML documents.