SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
-
Apr 19, 2009, 07:14 #1
- Join Date
- Oct 2007
- Location
- United Kingdom
- Posts
- 622
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
Correct thead and tbody for a table structure?
Hello, until recently I have always written a html table like this:
Table Example 1a
HTML Code:<table summary="an example of writing a table"> <tr> <th scope="col">Table Header 1</th> <th scope="col">Table Header 2</th> <th scope="col">Table Header 3</th> </tr> <tr> <td>Table Data 1</td> <td>Table Data 1</td> <td>Table Data 1</td> </tr> <table>
HTML Code:<table summary="an example of writing a table"> <tr> <th scope="row">Table Header 1</th> <td>Table Data 1</td> <th scope="row">Table Header 2</th> <td>Table Data 1</td> <th scope="row">Table Header 3</th> <td>Table Data 1</td> </tr> <table>
For example 1a it seems pretty easy:
Table Example 1b
HTML Code:<table summary="an example of writing a table"> <thead> <tr> <th scope="col">Table Header 1</th> <th scope="col">Table Header 2</th> <th scope="col">Table Header 3</th> </tr> </thead> <tbody> <tr> <td>Table Data 1</td> <td>Table Data 1</td> <td>Table Data 1</td> </tr> </tbody> <table>
Table Example 2b
HTML Code:<!-- ???? :-S ???? -->
ro0bearLast edited by ro0bear; Apr 19, 2009 at 07:21. Reason: corrected spelling
-
Apr 19, 2009, 07:17 #2
- Join Date
- Nov 2004
- Location
- Ankh-Morpork
- Posts
- 12,158
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Code HTML4Strict:<table summary="an example of writing a table"> <tbody> <tr> <th scope="row">Table Header 1</th> <td>Table Data 1</td> <th scope="row">Table Header 2</th> <td>Table Data 1</td> <th scope="row">Table Header 3</th> <td>Table Data 1</td> </tr> </tbody> <table>
(I must say example 2b looks odd. Should'nt it be like this?)
Code HTML4Strict:<table summary="an example of writing a table"> <tbody> <tr> <th scope="row">Table Header 1</th> <td>Table Data 1</td> </tr> <tr> <th scope="row">Table Header 2</th> <td>Table Data 2</td> </tr> <tr> <th scope="row">Table Header 3</th> <td>Table Data 3</td> </tr> </tbody> <table>
)
Birnam wood is come to Dunsinane
-
Apr 19, 2009, 07:20 #3
- Join Date
- Oct 2007
- Location
- United Kingdom
- Posts
- 622
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
That was quick Tommy!!!
Nice simple answer too
Thanks
Bookmarks