Question:

What is the command to add a background color to an HTML document?

by  |  earlier

0 LIKES UnLike

What is the command to add a background color to an HTML document? Also the command for a background image?

 Tags:

   Report

4 ANSWERS


  1. <body bgcolor = "color">

    <body background = "url">


  2. <body bgcolor="COLOR">

    <body background="URL">

    -

    Or

    -

    <body style="background-color: COLOR;">

    <body style="background-image: url('URL');">

    --

    Don't actually put the color or the URL in caps.

  3. The body and css examples are good. The answer with only three characters for color is wrong.   Here's a chart for the 216 "websafe" colors with their numerical values:

    http://www.lakeffect.net/216color.html

    For your first site the easiest way is to use <body bgcolor = "#ff9999"> or any other hexadecimal number.  You can also set bgcolor values in tables, table rows, and table data.

  4. In your CSS file:

    body {

    background: #FFF url(urlhere);

    }

    #FFF = White

    urlhere, just put the image url

    You can add extra details for the background image:

    no-repeat

    top left

    etc.

Question Stats

Latest activity: earlier.
This question has 4 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.