AlfieWebDevTips Homefor new and experienced developers
[Home Home] [Web Development Web Development ] [Code Generators Code Generators ] [Resources Resources ] [Contact Us Contact ] |WebDevTips Privacy Privacy |
Print This Page

You are here : Home - Web Development - HTML - The Body Tag

The Body Tag



Watch that body

Most computer platforms and browsers use white as their default page colour so most PC/Mac users tend to only put a <body> tag if they want to display their site on a white background. Why should they even think about it - after all, when they look at the page in their browser the background color is white.

On other platforms/browsers, the default page colour is gray (eg. Linux, Opera and most Amiga browsers) so if you have images that are designed to work on a white background, believe me when I tell you it looks horrible on a browser that doesn't use white as the default.
(change your browser color settings so they do not use windows colors and you will see what I mean)
So, if you are using a white background make sure you specify the background colour in your body tag as follows

<body bgcolor="white">
or
<body bgcolor="#FFFFFF">

I really have to give an example here. Here is the entire body tag of one of the most popular and well known sites that everybody uses. http://www.yahoo.com

Here is the Yahoo body tag in full - <body>

No it is not a mistake and NO it is not something that has just recently happened. I have surfed the net for a good few years now, and for many months I was using an Amiga browser. I couldn't understand why there was all this hype was about Yahoo.

The site had a gray background and all the images had white antialiased edges. It always has and always will look horrible on other platforms/browsers until they fix the body tag. So, if someone from Yahoo happens to visit this site, you know what needs to be done to fix your site. If you fix it, let me know and I'll find another example to replace this one.

http://www.excite.com almost get it right. Here is their full body tag

<body vlink=336699 link=000066 alink=000066 bgcolor=FFFFFF text=000000>

Although this appears correct, and the background color appears white on my PC, it is not valid syntax and browsers that are strict about html will not display any of the colours in this body tag. (Trust me, I know from experience)

Colour values must be preceeded by the # symbol. So, as with Yahoo, if anyone from Excite passes by, here's the code for you to cut and paste into your site.

<body vlink="#336699" link="#000066" alink="#000066" bgcolor="#FFFFFF" text="#000000">

Let me know when it's done and I will remove the above example.

Now you know the reason why you must define your background colour (EVEN if it is white).






Google
 

[back to top of page]   

[labelled with icra -  - this link will open in a new window] [RSS Content]

[Copyright © WebDevTips]