Basics
Creating a Document
Head and Body Elements
Formatting Text
Creating Lists
Embedding Images
URLs Explained
Linking to Documents
Creating Tables
Forms Form Basics
Input and Textarea
Select Lists
Frames Framesets
The Frame Element
Nested Framesets
Targetting Frames
Inline Frames
Tips and Tricks Meta Tags
Transition Effects
HTML Generators Create a Document
Create a List
Create a Table
HTML
Basics
Implementing CSS
CSS Syntax
Pseudo Classes/Elements
CSS Classes
CSS Properties Font Properties
Color and Background
Text Properties
Border Properties
Margins and Padding
Size and Position
Tips and Tricks Menu Buttons
Special Effects
CSS
Basics
Running a Script
Variables
Expressions and Operators
Objects.Properties.Methods
The Date Object
Strings
Regular Expressions
Defining RegExp Patterns
Branches and Conditions
Loops
Arrays Array Basics
Array Methods
Sorting Arrays

User-Defined Functions
Cookies
Windows
Frames
Tips and Tricks Image Replacement
Using Includes
Form Validation
Debugging
JavaScript
Basics
Creating a Script
Running a Script
Variables
Expressions and Operators
Strings Strings Basics
Strings and Substrings
Replacing Substrings
Regular Expressions
Branches and Conditions
Loops
Arrays Array Basics
Array Functions
Sorting Arrays
User-Defined Functions
Include and Require
Uploading Files
File Functions
Session Variables
Tips and Tricks Page Templates
Form Reply Scripts
Form Validation
JavaScript to PHP
PHP
Basics
Create and Drop
Show and Describe
Insert, Update and Delete
Querying
Join Queries
Functions
Table Locking
PHP/MySQL Functions Accessing a Database
Querying with PHP
Create and Drop with PHP
Insert and Update with PHP
Frequently Used Functions MySQL
Basics
Layout and Navigation
Page Content Style
Web Page Copy
Graphics and Animation
HTML Forms
Accessibility
Legal Requirements
MySQL
HTMLBasicsCreating a DocumentHead and Body ElementsFormatting TextCreating ListsEmbedding ImagesURLs ExplainedLinking to DocumentsHTML Creating TablesCreating TablesForms - BasicsInput and TextareaSelect ListsFramesetsThe Frame ElementNested FramesetsTargeting FramesInline Frames

Home > HTML > Creating Tablesprinter version

HTML - Creating Tables

HTML provides tables for structuring numerical or other information in an accessible way - such as with a bus timetable. However, many designers use tables to format chunks of content into columns and rows.

This is frowned upon by some designers who say that the <div> element (covered in CSS) should be used for this and that tables should only be used for their intended purpose.

The Basic Structure of a Table
<table>
    <tr>
        <th>
            Heading in here
        </th>
        <td>
            Content in here
        </td>
    </tr>
</table>


A table has only one <table> element, which must have a closing tag, but there may be multiple <tr>, <th> and <td> elements, each of which must have closing tags.

The <tr> elements enclose the <th> and <td> elements and provide the rows of the table.

The <th> elements enclose the cell headings and the <td> elements enclose the content and provide the columns of the table.

The <th> element is optional and may be omitted if a heading above each cell is not required.

By default headings within <th> elements are displayed in bold text and centred whereas within <td> elements, content is displayed in normal text and left aligned.

If multiple rows and multiple columns are employed then the number of columns in each row must match i.e. each <tr> element must enclose the same number of <th> or <td> elements.

<table> Attributes

The <table> element supports a number of attributes, some of which are listed below.

A Table tag with attributes
<table align="center" bgcolor="#ff0000" border="2" cellpadding="4" cellspacing="8" width="50%">


<tr> Attributes

The <tr> element supports a number of attributes, some of which are listed below.

<th> and <td> Attributes

The <td> element supports a number of attributes, some of which are listed below.

Previous - HTML linking to other documents Previous - Linking to Other Documents     Next - Forms - Basics Next - HTML forms - basics


Privacy | Terms | Contact | Links | Sitemap | RSS Feeds RSS and JavaScript Feeds
©2010 www.webdesignworkmate.co.uk all rights reserved 
Design and Production by smallbizonline website design © 2000-2010
Valid HTML 4.01! Level Double-A conformance icon, W3C-WAI Web Content Accessibility Guidelines 1.0Valid CSS!
Tips and TricksMeta TagsTransition EffectsHTML GeneratorsCreate a DocumentCreate a ListCreate a Table
Got any HTML Tips?
Send me your tip and if it's suitable I'll put it on the site, credit it to you and add a link back to your site.
Recommended Reading
html_and_xhtml

html and xhtml complete reference

learning web design beginners 

guide