Home | Add to Favorites | Ebooks Directory | News  
HTML Resources
Home
HTML  Article
HTML  Tutorial 
HTML Guide
Books
HTML Code
HTML Editor

HTML Table Attributes Tutorial


Example 5

Drawing the Table border and other attributes

The various attributes of the <TABLE> tag are BORDER for drawing the border of the all rows, columns and the entire table, CELLSPACING to define the space between the neighborhood cells, CELLPADDING to define the space between the walls of the cell and its text within it, ALIGN to align the data to RIGHT,LEFT,
CENTER and BGCOLOR defines the background color of the table .


 

<HTML>
<HEAD>
<TITLE>
HELLO WORLD SAMPLE HTML CODE
</TITLE>
</HEAD>
<BODY>
<TABLE BORDER=1 ALIGN="center" CELLSPACING=2 CELLPADDING=2 BGCOLOR="yellow">
<TR>
<TD>
NAME
</TD>
<TD>
AGE
</TD>
</TR>
<TR>
<TD>
JOHN
</TD>
<TD>
22 YRS.
</TD>
</TR>
<TR>
<TD>
HAN
</TD>
<TD>
42 YRS.
</TD>
</TR>
<TR>
<TD>
EVE
</TD>
<TD>
78 YRS.
</TD>
</TR>
</TABLE>
</BODY>
</HTML>



 
Example 6

Taking the text to the next line and spacing

The text within <HTML> and </HTML> tags doesn't recognize new line and multiple spaces. So, the <BR> (it doesn't need closing tag </BR>) is used for line breaks and multiple &nbsp; s are used for multiple spaces.

<HTML>
<HEAD>
<TITLE>
HELLO WORLD SAMPLE HTML CODE
</TITLE>
</HEAD>
<BODY>
HELLO WORLD! <BR>
THE LUNCH BREAK!
</HTML>