cascading style sheets tutorial

HTML Element Selectors

Explained

HTML Element selectors select any of the elements on a page that match the selector. For example, the selector B selects any bold elements on the page (that is any element marked up as <B></B>. Similarly, the P selector selects every paragraph, that is every element marked up as <P></P>.

Syntax

The format of an HTML element selector is simple, it is just the tag that you use to mark up an element on a HTML page. Any HTML tag (theoretically) can be used in this way.

Some examples are

BODY selects the <BODY> element

LI selects any elements marked up as <LI></LI>

and so on.

Use

Using the HTML element selector, you can change the appearance of any or every element on your page. Theoretically.
In practice, the major browsers still have default style for different kinds of element that you can't override. Depending on the browser and version of it that you view a page in, you may or may not be able to completely change the appearance of a heading, for instance. But you can give your pages a very significantly different look and feel with a style sheet, and then alter that appearance by simply editing the style sheet, and not even opening the actual HTML document.

When people first learn about style sheets, they generally think that they are restricted to one kind of selector, this one. But that is far from the case. Read on for more.