how to put color on a webpage

change the color

all that is needed to change the background color of a webpage is to add the bgcolor attribute to the body tag in this example the bgcolor is set to pale blue (hex #0099FF), but feel free to pick a different color from the paintbox (opens in a new window)
for a list of named colors like red/blue click here (opens in a new window)

adding bgcolor to the body tag

the bgcolor can be added as a hex number
<body bgcolor=#0099FF
>
or as a named color
<body bgcolor="blue">

change the text color

all that is needed to change the text color of a webpage is to add the text attribute to the body tag in this example the text is set to yellow (hex #FFFF00)
pick a different color from the paintbox (opens in a new window)

add a background image

it's just as simple to add a background image to the webpage all that needs to be done is add the background attribute to the body tag
<body bgcolor=#0099FF text="#FFFF00" background="bluetile.jpg">
you can save the image to disk if you want to see it tiled on your webpage
just rightclick on it and select 'save image as' from the popup

rightclick on this image and select 'save image as' from the popup menu This is the blue tile, the bgcolor attribute is also included in the body tag. It is essential that the background color of the page is similar in color to the background image, because some users surf with images turned off.
If we ommited the bgcolor attribute users with images turned off would find reading yellow text on a default white background a dire strain



this is yellow text on the blue background



this is yellow text on the blue background image


« back | html tutorial | next »

//if the user is using IE 4+ if (document.all) document.write('click here to bookmark this site!') else document.write('press Ctrl and D to bookmark this page')
home
html tutorial css tutorial javascript webmaster articles link exchange

html tutorial

make money
from your website