How Do I Make Text Red in HTML?

By David Wayne

HTML uses a system of reserved keywords called tags that specify element attributes, such as font style, color and alignment. In HTML 4.01 and earlier versions, the tag employs a color attribute that defines a single text block's color. Beginning with HTML5, the tag is deprecated, so you must define text color using CSS, a styling language that seamlessly integrates with HTML.

Use In-Line HTML Tags

An HTML file declares its HTML version in the document type declaration on the first line. HTML 4.01 files display their version next to a Document Type Definition identifier, while HTML5 files simply display “html” next to the Doctype keyword. In files using HTML 4.01 and earlier versions, enclose the tag within a

, or paragraph, tag to define the color of a paragraph's text, as in the following example:

This paragraph has small, red sans-serif text.

Space-separated font attributes follow the tag keyword within the opening brackets. The face and size attributes specify the font family and size, respectively. Closing tags include a “/” before the keyword.

Use Internal CSS Attributes

Insert CSS attributes within the Substitute any text type -- for example, “p” or “body” -- for “h1” in the example to make text of that type red and centered throughout the document. Place each CSS attribute on a new line and place a semicolon at the end of each line.