Cheap Web Hosting Directory
 
Menu

Website Hosting
Windows / NT Hosting
Linux / Unix Hosting
E-Commerce Hosting
Dedicated Servers
PHP / MySql Hosting
Managed Hosting
Domain Registrar
Reseller Hosting
FrontPage Extension
Co-location Hosting
ASP / ASP.Net Hosting
Shared Hosting

Compare Hosting
Unix Hosts
Windows Hosts

Features
WebHosting Articles
WebHosting Specials
WebHosting Reviews
WebHosting News
HTML Tutorial
Free Software
Glossary & Terms

Site Information
Link To Us
Privacy Policy
Contact Us


Popular Hosts


HTML Tutorial
Chapter 10: Tables

Tables...

Example of a Table...
What are tables used for?
Tables are used to make data easier to interpret or to just give your document more impact.

<table border=4>
<tr>
<th>What are tables used for?</th>
</tr>
<tr>
<td>Tables are used to make data easier to interpret
or to just give your document more impact.</td>
</tr>
</table>

Tables are one of the most challenging things to code with HTML. It isn't very hard, it just takes a while to get the hang of. Tables start with the <table> tag, and usually contain the border=n attribute within the opening tag. If the border=0, than the table's border is invisible. Usually when you do not use the border attribute the table border will become invisible. This is useful when you want to align text in rows and columns, but don't want a table border around it. border=1 is a thin border. border=2 is a little thicker, border=3 a little more thick.. and so on. The table MUST end with a </table> tag, or the table will not appear at all!

Example of tables with borders...
This table has a border of 0.
<table border=0>
<tr>
<td>This table has a
border of 0.</td>
</tr>
</table>
This table has a border of 3.
<table border=3>
<tr>
<td>This table has a
border of 3.</td>
</tr>
</table>

Each row within the table is defined by the opening <tr> tag and the optional </tr> closing tag. Within each table row are table cells, which are defined by the <td> opening and </td> closing tags. Most table rows contain more than one cell. Many times, you will need a heading for a column of cells of the first row. To do this, you will use the <th> opening and </th> closing tag. The table heading tag makes the text in that cell BOLD and CENTERED. You only need use the heading cells when necessary.

Example of a table with multiple rows and columns...
Heading AHeading BHeading C
Cell ACell BCell C
Cell DCell ECell F

<table border=2>
<tr>
<th>Heading A</th>
<th>Heading B</th>
<th>Heading C</th>
</tr>
<tr>
<td>Cell A</td>
<td>Cell B</td>
<td>Cell C</td>
</tr>
<tr>
<td>Cell D</td>
<td>Cell E</td>
<td>Cell F</td>
</tr>
</tr>
</table>

But what if you want your table to look like the following?

Heading AHeading BHeading C
Cell A & DCell BCell C
Cell ECell F
<table border=2>
<tr>
<th>Heading A</th>
<th>Heading B</th>
<th>Heading C</th>
</tr>
<tr>
<td rowspan=2>Cell A & D</td>
<td>Cell B</td>
<td>Cell C</td>
</tr>
<tr>
<td>Cell E</td>
<td>Cell F</td>
</tr>
</tr>
</table>

Notice how the rowspan=2 attribute was added. This allows that cell to span two rows. If you want a cell to span more than column, use the colspan=n attribute. Also, you may wish to use the ALIGN and VALIGN attributes to align the contents of cells. If you wish to change the horizontal alignment of the contents of a certain cell, add ALIGN=LEFT, ALIGN=CENTER, or ALIGN=RIGHT to the opening <td> tag. If you wish to change the vertical alignment of the contents of a cell, use the VALIGN=TOP, VALIGN=MIDDLE, or VALIGN=BOTTOM attributes. You may also want to try out the WIDTH=n% attribute, to change the width of a table or a cell.

Example of ALIGN attributes within a table...
Left AlignmentCenter AlignmentRight Alignment
    
  <table border=1 width=100%>
  <tr>
  <td align=left>Left Alignment</td>
  <td align=center>Center Alignment</td>
  <td align=right>Right Alignment</td>
  </tr>
  </table> 
      



Your own HTML page...

Right click on the image in the centre of the black-bordered box below, and select "Save Image As" / "Save Picture As", or similar. Save it as "phxsuns.jpg" in the same directory where your home page "Home.htm" is stored.

Image phxsuns.jpg

Tables can be used without borders, to align images and text next to each other. Change the heading of your home page to a table, like this:

<html>
<head><title>My Home Page</title></head>
<!-- The body starts here - and a background image is loaded -->
<body background="bgnd.gif">

<!-- This is a table: 3 columns, 1 row, no border -->
<table border=0 width=100%>
<!-- Beginning of the row -->
<tr>
<!-- Beginning of the first cell -->
<td align=center>
<!-- The first cell contains an image -->
<img src="fraidbut.gif">
<!-- End of the first cell -->
</td>
<!-- Beginning of the second cell -->
<td align=center>
<!-- The second cell contains the original heading -->
<font color="Blue"><h1>YOURNAME's Home Page</h1></font>
<!-- End of the second cell -->
</td>
<!-- Beginning of the third cell -->
<td align=center>
<!-- The third cell contains an image -->
<img src="fraidbut.gif">
<!-- End of the third cell -->
</td>
<!-- End of the row -->
</tr>
<!-- End of the table -->
</table>

<!-- This is a horizontal line -->
<hr>
.
.
.
</body>
</html>


Save the text file as "Home.htm".

Go To Chapter 11

Most Popular Hosting Companies
   

Don't let expensive hosts eat your profits!

Lunarpages is dedicated to taking your web hosting needs to the next level. Because our focus is foremost on providing you with high quality service and accountability, you can depend on us to always be there for you.

 

Tired of bouncing from host to host? We offer 24/7/365 phone support, 99.9% uptime, and have a 30 day money back guarantee. Your site will be on a top of the line Dual Xeon server that provides INSTANT backups of your site. Our control panel is one of the best in the industry, and has over 39 scripts that can be installed with a click of the mouse.
 

Bluehost Web Hosting $6.95

Our Professional Web Hosting plans include: 1 Gigabyte Hosting Space; 1,000 POP Email Accounts; 50 GIGS of Transfer; SSL, FTP, Stats; CGI, PHP, MySQ; 2000/2002/2003 Front Page Extensions; Free Domain Included; Toll Free Support

 

Get 20,000 MB of space and 400 GB of transfer includes MIVA Merchant 5 storefront software. Other features include Host 20 seperate websites, 24x7 LIVE support, Urchin web statistics, free website builder, spam & virus protection.

 

Easy CGI Web Hosting

$7.96 per month, Perl, PHP and ASP Support, FrontPage 2002 Extensions, MS Access, MySQL, MSSQL, Hosting Control Panel, ColdFusion, WebTrends Traffic Reports, Shared SSL Access etc. At Easy CGI we maintain our own Data Center located in the same building as our corporate headquarters. This allows us to quickly assess and resolve any problems that may occur and monitor our systems to the highest degree to keep our network running at 100%.


News and Articles

 

  Latest News

©

  Latest Articles
 


Sprint To Participate in Upcoming Financial Conferences
Sprint (www.sprint.com) today announced it will participate in the following upcoming conferences ...

Cisco Systems to Acquire FineGround
Cisco Systems today announced a definitive agreement to acquire privately-held FineGround ...

HP and Bank of India Win IT Outsourcing Award
HP and Bank of India today announced that the companies' IT outsourcing engagement has been ...

More News


Switching Web Host
Moving a web site to a new host is not as difficult as you may think. ...

Linux vs. Windows Web Hosting, Does It Make A Difference?
One of the most confusing decisions someone new to web hosting will have to make is which platform ...

Reseller Web Hosting - A Cheaper Alternative?
There comes a time when the internet bug hits us all and we tend to acquire a wealth of domain ...

More Articles


Popular Hosts
250GB Space and 2500GB Transf for $6.95 a month!


Copyright ©2008 BEtheNet.com