Simple tables only have one section, the body, which consists of rows and columns. However, you might want to include additional information in your table by defining a table header and footer to complement the information in the body.
For example, the header could contain the header rows, the body could contain the data, and the footer totals for each column. The advantage to breaking up the table into the three sections is that some user agents will then allow the user to scroll the body of the table separately from the header and footer.
Note: The HTML 4.01 specification dictates that you must use all three sections— header, body, and footer—if you use any. You cannot use only a header and body section without a footer, for example. If you don’t intend to use one of the elements, you must still include tags for the section, even if the section is otherwise empty.
The table header is delimited by <thead> tags—otherwise, its content is exactly like any other table section, delimited by <tr>, <td>, and optionally <th> tags. For example, consider the following table header section:
Other than being delimited by <tbody> tags, the table body is defined and formatted just like any other table element. The table footer is delimited by <tfoot> tags and is formatted like the other two sections.
Tip:Although it seems counterintuitive, you should place the <tfoot> section before the <tbody> section in your code to allow the user agent to correctlyanticipate the footer section and appropriately format the <tbody> section. All three section tags support align and valign tags for controlling text alignment within the section. (The char and charoff attributes are also supported for align=“char”.)
For an example of a table with all three sections, consider the following code and itsoutput.
The three table sections (header, body, footer) can be set off by custom rules.
Note how the three sections are set off by rules, but the table is otherwise devoid of rules. This is because of the rules=“groups” attribute in the <table> tag. Also note how alignment attributes are used in the section tags to center the text in the table.
HTML Related Interview Questions
|XML Interview Questions||HTML 4 Interview Questions|
|HTML Interview Questions||HTML 5 Interview Questions|
|HTML DOM Interview Questions||Java Interview Questions|
|CSS Interview Questions||Java Abstraction Interview Questions|
|Dynamic HTML Interview Questions||XHTML Interview Questions|
Introducing The Web And Html
What Goes Into A Web Page?
Starting Your Web Page
Lines, Line Breaks, And Paragraphs
Page Layout With Tables
Introducing Cascading Style Sheets
Creating Style Rules
Padding, Margins, And Borders
Colors And Backgrounds
Tables Table Styles
Defining Pages For Printing
Dynamic Html With Css
Introduction To Server-side Scripting
Introduction To Database-driven Web Publishing
Creating A Weblog
Introduction To Xml
Xml Processing And Implementations
Testing And Validating Your Documents
Choosing A Service Provider
Uploading Your Site With Ftp
Publicizing Your Site And Building Your Audience
Maintaining Your Site
The Web Development Process
Developing And Structuring Content
Designing For Usability And Accessibility
Designing For An International Audience
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.