HTML - body tag

Here you learn how to code the BODY tag.

The body of a web page contains the content (text, images, colors, graphics, etc). Before CSS (style sheets) became popular, many webmasters used the body tag as a way of formatting the content. Now it is rare to do this and the presentational attributes of the BODY tag have been deprecated. This example shows the old way of formatting the body. Don't format the body this way. Use the example below it that uses CSS.

BODY tag - DO NOT USE THIS CODE

<html>
<head>
<title>HTML tutorial</title>
</head>

<body bgcolor="white" text="black">
content
</body>

</html>

BODY tag - CORRECT USE OF CODE

This example code shows you the correct way to format the BODY tag. Notice the link to the stylesheet that formats the body content.

External CSS File

This is your external CSS file named "sylesheet.css".

body { background-color: white; }



PHP File

<html>
<head>
<title>HTML tutorial</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>

content
</body>

</html>


 
Bookmark this page:
   
Rate this page:
  • Currently 3.19/5
  • 1
  • 2
  • 3
  • 4
  • 5

Rating: 3.2/5 (156 votes)



Comments:

please post comments
admin November 21, 2006

 
Nickname:
Comment:
Security: 1+1=
Hosts
Lunarpages.com Web Hosting
iPowerWeb

Domain Registrars
PPC Networks
Logos
Affiliate Networks
Resources