View Full Version : backround color in HTML

01-19-2004, 12:59 AM
i'm very new at HTML. Is there a way to change the backround color of a page with it?

Willy Duitt
01-19-2004, 01:20 AM
Try this:

<body bgcolor="#FFFF0F">
<a href="javascript:void(document.bgColor=prompt('Background Color','#C0C0C0'))">
Change BgColor</a>


01-19-2004, 01:55 AM
It's a lot better and easier to use CSS.

Just put the following snippet inside your <head>

<style type="text/css">
body {
background: #ff0;

// freak

01-19-2004, 03:36 AM
thanx, those work great! since freak's looked a little shorter I used it, but, if yellow isn't my color, what do I change to change the color?

Willy Duitt
01-19-2004, 04:42 AM
Oh, I thought you wanted to change the background color once the page was displayed. :o

To change the background color in freaks example.
Change the hexidecimal number highlighted in red

eg: background: #ff0;

You can find some additional color values here (http://www.pixy.cz/apps/barvy/index-en.html).


01-19-2004, 03:11 PM

Have a look at the tutorials on www.w3schools.com

They are very quick and easy and are broken down into individual bitesize sections

Give them a shot - you won't look back!!


[edit:] Fixed your link url ... had an extra dot (.) :)

01-19-2004, 09:59 PM
Here's some more CSS basics and I would highly recommend you to use external CSS vs. internal.


01-20-2004, 10:43 AM
Thanks for that link. It is resourceful.

01-20-2004, 09:30 PM
ya, i just checked those out. Great sites! thanx