Web Design Stuff
HTML Tutorials    CSS Tutorials    Web Hosting   Resources
Create a Web Page 101
Making Web Pages Intro What is a Web Page? Why Make a Web Page? The History of HTML Learn HTML or XHTML?
Basic HTML
Basic HTML Tutorials Basic HTML Necessities How to Make a Web Page How to Edit a Web Page The Basics of HTML Tags Basic HTML Page Structure HTML Attributes
HTML Font Codes
HTML Font Codes Intro HTML Font Color Codes HTML Font Size Codes HTML Font Style Codes HTML Bold/Italic Codes Combining Font Codes
Formatting Text
Formatting Text Intro Making Paragraphs Miscellaneous Formatting Headings & Subheadings Creating Hyperlinks
Using Graphics
Using Graphics on the Web Add Graphics to Your Pages Graphics and Accessibility How to Align Graphics Page Color & Background Graphics as Hyperlinks Horizontal Rules
Creating Tables
HTML Tables Tutorials HTML Table Fundamentals Background & Border Color Table Frames & Rules Table Width and Alignment Cells 1 -Space & Alignment Cells 2 -Row Column Span Cells 3 -Width & Height
Making Lists
HTML Lists Tutorials Bulleted Lists Numbered Lists Definition Lists
HTML Frames
HTML Frames Tutorials Using Frames for Layout Advanced Frame Layouts Putting Hyperlinks in Frames Frame Border Width Color, Margin and Control Problems with Frames SmartFrames: A Solution SSI: An Alternative to Frames
Web Page Forms
Making Feedback Forms A Simple Feedback Form Installing NMS FormMail Debugging Your Setup My Web Host is Out to Lunch User Input Components Text Fields Checkboxes & Radio Buttons Dropdown Menus Push Buttons Layout and Presentation
Basic CSS
Basic CSS Tutorials What is CSS? Why You Should Use CSS How to Use CSS Inline Styles Embedded Style Sheets External Style Sheets Class Selectors ID Selectors Combining Selectors
CSS Properties
CSS Properties Intro Font Styles Width, Height & Spacing Borders Backgrounds Position Float & Alignment Hyperlinks
All About Web Hosting
Hosting Your Own Website What is a Web Host? Your Website's Home Page Building a Website Offline About Free Web Hosting Best Free Web Hosting Commercial Web Hosting How to Get a Domain Name Ecommerce Web Hosting Web Hosting Terminology
Free Web Design Tools
Best Free Website Tools Best Free Text Editors Best Free Graphics Editors Free Website Analysis Tools
Setting Up HTML Kit
HTML Kit Introduction How to install HTML Kit Screenshot Breakdown Basic Configuration Overall Appearance Shortcuts and Startup Editing Window Customizing Toolbars Using the Favorites Tab Making a New Actions Bar Odds and Ends
Free Templates
Free Website Templates Two Column Fixed Width Three Column Liquid Layout Miscellaneous Templates Dynamic Menu Effects Two Column Experimental Terms of Use About These Templates
Website Templates Help
Getting Started Template Zip File Download How to Edit Your Template What to Edit in the HTML How to Add Your Logo Making a Website
Web Design Tips
Web Design Basics Tables vs. Tableless Using Tables for Layout Example Table Layouts World's Crappiest Web Page
Twitter Backgrounds
Twitter Backgrounds Intro Cool Twitter Backgrounds Cool Twitter Backgrounds 2 Plain Twitter Backgrounds Dark Twitter Backgrounds Best Twitter Backgrounds Cute Twitter Backgrounds Music Twitter Backgrounds Music Twitter Backgrounds 2 Twitter Backgrounds 101 TERMS OF USE
All About Web Browsers
What is a Web Browser? Mozilla Firefox Internet Explorer Opera How to Set Up Firefox Top 5 Firefox Extensions
 
Contact
Post Some Feedback Send Me An Email Iron Spider Blog About Iron Spider... Site Conventions
 
 
 

 

HTML Table Fundamentals

 
<table><tr><td>
Table content goes here...
</td></tr></table>
Next to the hyperlink, one of the most widely used HTML elements is the table element. Take a peek at the source code of any big corporate website and you are bound to see a plethora of tables, table rows and table data cells, and then nested inside many of the cells you will find even more tables with their respective rows and cells.

Effectively then, one would imagine to find most of these web pages stuffed from margin-to-margin with tabular data but such is not the case, or rather, to the untrained eye, the use of tables is not readily apparent. This is because tables are used on web pages primarily for layout and design as opposed to being used for their original purpose, i.e. presenting a collection of related data in neatly organized rows and columns.

Thus, by way of introduction, we will focus on exploring the use of HTML tables as they were originally intended, or in other words, using tables as tables since this will serve better to illustrate exactly how they work.


HTML Table Codes


Tables are created using the table element which uses both a start and an end tag. The <table>...</table> tags are required to contain at least one set of <tr>...</tr> tags which themselves are required to contain at least one set of <td>...</td> tags. Each set of <tr>...</tr> tags creates one table row while each set of <td>...</td> tags creates one table data cell.

The following represents an HTML table in its most fundamental state defining one row which itself contains one data cell:


Example 1

<table><tr><td>Cell content goes here... </td></tr></table>



This will merely create a 'box' around the cell content and will perform like a block element. Using the border attribute in the <table> tag we can establish a decorative frame around the table whose thickness is defined in pixels:

Example 2 - SOURCE CODE

<table border="5"><tr><td>Cell content... </td></tr></table>


Example 2 will produce the following result on your web page, i.e. a basic table with a 5 pixel border drawn around it:


Example 2 - RESULT
Cell content...


The basic HTML table model is said to be 'row primary' in that the table rows are specified explicitly while columns are implied by the number of table data cells appearing in the rows. The source code in Example 3 will create a table having three rows and two columns:


Example 3 - SOURCE CODE

<table border="5">
   <tr><td>Row 1, Cell 1</td><td>Row 1, Cell 2</td></tr>
   <tr><td>Row 2, Cell 1</td><td>Row 2, Cell 2</td></tr>
   <tr><td>Row 3, Cell 1</td><td>Row 3, Cell 2</td></tr>
</table>




And this will produce the following effect on your web page:


Example 3 - RESULT
Row 1, Cell 1Row 1, Cell 2
Row 2, Cell 1Row 2, Cell 2
Row 3, Cell 1Row 3, Cell 2


There are a number of attributes which you can apply to the <table> tag to control the background and border color of your table. These are covered next...





Best Free Stuff
for webmasters

Free Text Editors
Free Graphics Editors
Website Analysis Tools
Free Website Templates

See also:

Best Free Web Hosting

 

If you need a .COM web address, you can get one quick and easy at...

www.GoDaddy.com
INTRO TOP NEXT~>
 
HTML Tutorials |  CSS Tutorials |  Web Hosting |  Domain Names |  Web Design Resources
Iron Spider © Copyright 2004-2011 Robert Darrell