Skip to content

HTML Document Structure & Styling Exam Summary

1. Document Head & Title

  • <HEAD> contains information about the document.
  • <TITLE> appears in the browser's top line and is used for bookmarks/favorites.
  • Title text should be descriptive for search engine indexing.

2. Document Properties (BODY Attributes)

Controlled via attributes of the <BODY> element for colors and background.

3. Color Codes

  • Set using RGB hexadecimal values (#RRGGBB).
  • Each 2‑digit section = amount of Red, Green, Blue (e.g., #FF0000 = red).

Basic Color Examples

Color NameHex CodeColor NameHex Code
Aqua#00FFFFNavy#000080
Black#000000Olive#808000
Blue#0000FFPurple#800080
Fuchsia#FF00FFRed#FF0000
Gray#808080Silver#C0C0C0
Green#008000Teal#008080
Lime#00FF00White#FFFFFF
Maroon#800000Yellow#FFFF00

Additional examples: Magenta=#FF00FF, Cyan=#00FFFF, Pink=#FF6EC7, Orange=#FF7F00.

4. BODY Element Attributes

Background Color

html
<body bgcolor="#FFFFFF"></body>

Text Color

html
<body bgcolor="#FFFFFF" text="#FF0000"></body>
  • Default text color is black.
  • LINK – initial (default blue).
  • VLINK – visited (default purple).
  • ALINK – active when clicked (default yellow).

Example:

html
<body
  bgcolor="#FFFFFF"
  text="#FF0000"
  link="#0000FF"
  vlink="#FF00FF"
  alink="#FF00"
></body>

Background Image

html
<body background="hi.gif" bgcolor="#FFFFFF"></body>

5. Text Formatting Tags

  • <B>Bold Face</B>
  • <I>Italics</I>
  • <U>Underline</U>
  • <P>New Paragraph</P>
  • <BR> Next Line

6. Changing Font

  • Face: <FONT FACE="fontname">...</FONT>
  • Size: <FONT SIZE=n>...</FONT> (n = 1 to 7)
  • Color: <FONT COLOR="red">...</FONT> or hex e.g., #ffffff
  • Combined:
html
<font size="4" face="Courier" color="red">...</font>