How to Set a Background Color in HTML

Setting the background color in HTML is not done through its own tag. Instead, it's done by setting an attribute in another tag, such as the body tag or a table or row tag. Color adds great appeal and readability (or sometimes unreadability!) to a website, so use it wisely.

Things You'll Need

  • HTML or text file editor
Show More

Instructions

  1. Set the Background Color

    • 1

      Open your text or HTML editing software and click wherever you want to set the background color. You must be just inside the already existing body, table, table row or table column tag of the element whose color you want to set. In the following example, you would click just after the word "table":

    • 2

      Type the following:

    • 3

      Ensure that the line now looks like this:

    • 4

      Remember that at the end of the table, you'll need a closing tag:

Tips & Warnings

  • Hexadecimal codes can be used to come up with 216 different colors, but its easier for most people to use the reserved keywords to define colors, such as "red" and "blue."

  • Overly bright colors can cause headaches, and backgrounds too similar to text colors can make your content impossible to read.

Related Searches:

Comments

You May Also Like

Related Ads

Featured