Tables
There are times when we wish to display data that is sorted into columns and rows. This is called tabular data and HTML has a <table> tag and sub elements for organizing such data. For example, a vegetable comparison table might consist of vegetable names and their corresponding color or nutritional value. Lets construct a simple table.
To begin, we open the <table> tag:
<table>
Immediately after <table> tag, we can include a <caption> tag to quickly inform the reader the intent of the table.
<caption>A table of vegetable colors.</caption>
Tables consist of rows and columns. The table row <tr> tag is used to seperate table rows, while table data <td> fits within each row.
Also note, the first row of this table will be reserved for table headers <th>. Headers let a reader know what each column, or row, of a table represents.
<tr> <th>Name of Vegetable</th> <th>Color</th> </tr>
Additional table rows <tr> and table data <td> will follow the same format as the table headers <th>, i.e. they will be typed in the same order.
<tr> <td>Carrot</td> <td>Orange</td> </tr> <tr> <td>Asparagus</td> <td>Green</td> </tr>
Lastly, we will close the table tag.
</table>
External Resources
Hackbook: Tables
Task Discussion
-
-
Al said:
Look at me, I'm a Table List of Awesome things Dates they come out Diablo 3 May 15 Rise Of the Pheonix May 15 Do we need anything more? No! -
-
Pau Company said:
Vita said:
Very nice, I like the colors and the background of the page..
Pau Company said:
Muchas gracias Vita, viniendo de ti es para mi todo un cumplido. Atentamente:
Vita thank you very much, coming from you is for me a compliment. Sincerely,
Pau Company
-
Mr. Plow said:
I knocked out a tables page, good times!
I've made html tables before but I didn't realize there was a caption tag.
-
Julio Garcia said:
My task with historical data of football (soccer) World Cup winners: http://htmlpad.org/tabela/.
By the way, I don't understand why Americans call "football" a game which is played mostly with hands.
joe palmer said:
Got me on that football, who knows! One of those things ha, nice table. Sports is good!
-
Kronosaurus said:
It's not fancy, but here it is http://htmlpad.org/tables/
-
Devinciweb said:
I didn't see an assignment on this one but here is a small data table. I know that tables are really out now other than for data. CSS3 is the preferable choice otherwise:
-
Moraino said:
This is my assignment for today:
-
Anonym said:
MI TABLA
vereis que uso algunas propiedades, tales como align etc... que supongo que con las css iran desapareciendo,pero creo que no está demás aprenderselas, ya que si queremos dedicarnos a esto, podriamos encontrarnos clientes que quieran actualizar su pagina a html5 sin variar el aspecto de la pagina, y en ese caso, deberiamos saber interpretar todas las propiedades que contien el documento a actualizar, que opinais?Tambien he encontrado algunos resumenes y ejercicios...y que opinais sobre maquetar la pagina entera con tablas?Os dejo el enlace -
demian said:
I just want to make a general comment on making tables. Whenever you create a very large data table with a scroll bar, I think you must include the <thead> and <tbody> tags, because they make the table much easier to read.
I'm just wondering if any of you have any opinion on using table for layout. Is that a thing of the past now? Is the CSS based layout the way to go? If not, in what instance does the table based layout have advantages over the CSS counterpart? Thanks.
alcinoe said:
Hi Demian,
Using tables for layout is not acceptable. Layout should be done through CSS only.
Elizabeth
joe palmer said:
Section 9 deals with it w/CSS3
Here are arguments
http://webdesign.about.com/od/tables/a/html5-tables-for-layout.htm
http://coding.smashingmagazine.com/2009/04/08/from-table-hell-to-div-hell/
http://phrogz.net/css/WhyTablesAreBadForLayout.html
And here are over a hundred arguments on it, page on and on it gets funny! I opine that the CSS Zen Garden web site (100's of web pages, exact same html but differant css) is not done with tables so who would learn tables now for style? That went out of style ha ha. When I first saw the zen garden I had a very hard time believeing that is all the same html.
http://stackoverflow.com/questions/83073/why-not-use-tables-for-layout-in-html
-
Vita said:
Ok... here's my table of some useful vitamins...

-
demian said:
Here's my page:
-
-
-
Stavros said:
I've worked a bit with tables. I read and used colgroup thead tfoot tbody. I discovered sup and br tags and also found out how to use special characters as the euro sign €
Never make it to align list of numbers to the decimal point no matter what. Googling I bumped into w3c's (Tim Berners-Lee's founder of the WWW concortium) html5 vocabullary, which I found really helpful http://dev.w3.org/html5/spec/Overview.html
This is the result of my work to the table task:
-
Luca Serpietri said:
-
Dar said:
TA-DAAAAA http://etherpad.mozilla.org:9000/basicmarkup
how does one change how the caption looks? I experimented with a few things and nothing seems to work so far.
joe palmer said:
Here are some things on the caption tag
http://www.htmlquick.com/reference/tags/caption.html
http://webdesign.about.com/od/tables/a/aa092606.htm
http://accessibility.umn.edu/use-the-caption-tag.html
http://www.pitstopmedia.com/sem/caption-tag-and-seo-complete-html-reference-guide-for-seo
http://www.html-5.com/tags/caption-tag/index.html
Your question is about appearance, which is almost always handled with CSS. It will come together, I talked about some of this on other questions recently, clicking my picture will take you to those threads. It is great that you tried changing it, and your work looks very good, keep going.
