|
|
|
|
Thread title: XHTML code for a table |
|
|
|
|
|
Thread tools
Search this thread
Display Modes
|
|
06-16-2008, 12:43 PM
|
#1
|
Status: Junior Member
Join date: Jun 2008
Location: India
Expertise:
Software:
Posts: 43
|
XHTML code for a table
please tell the code for a table in XHTML.
|
|
06-16-2008, 01:17 PM
|
#2
|
Status: I love this place
Join date: Nov 2007
Location: Aberdeen, Scotland
Expertise: Design / Coding
Software: Photoshop, iTunes, Firefox
Posts: 660
|
HTML Code:
<table></table>
This is the main table tags
This is what makes a row
This is what makes a column
HTML Code:
<table>
<tr>
<td>Hello</td>
</tr>
</table>
That would make a one row and one column table
HTML Code:
<table>
<tr>
<td>Column 1 </td>
<td>Column 2 </td>
</tr>
<table>
That gives us 2 Columns
HTML Code:
<table>
<tr>
<td>Row 1</td>
</tr>
<tr>
<td>Row 2</td>
</tr>
</table>
That gives you two rows
HTML Code:
<table>
<tr>
<td>Row 1, column 1</td>
<td>Row 1, column 2</td>
</tr>
<tr>
<td>Row 2, column 1</td>
<td>Row 2, column 2</td>
</tr>
</table>
That gives you a 2 columned, 2 rowed table.
|
|
06-16-2008, 04:29 PM
|
#3
|
Status: Member
Join date: Aug 2006
Location: Wisconsin
Expertise:
Software:
Posts: 132
|
I wouldn't recommend tables unless you need to put tabulated data on your website. If you are trying to adhere to new standards and still making a site in a table, I would learn the benefits of CSS and re-code your site.
|
|
06-16-2008, 05:02 PM
|
#4
|
Status: #pugs {display: block;}
Join date: Jan 2007
Location: Chicago
Expertise: CSS, HTML, PHP
Software: Sublime Text 2
Posts: 1,187
|
Veerle has a great tutorial/example of a proper XHTML table.
Code:
<table id="mytable" cellspacing="0" summary="The technical
specifications of the Apple PowerMac G5 series">
<caption>Table 1: Power Mac G5 tech specs </caption>
<tr>
<th scope="col" abbr="Configurations" class="nobg">Configurations</th>
<th scope="col" abbr="Dual 1.8GHz">Dual 1.8GHz</th>
<th scope="col" abbr="Dual 2GHz">Dual 2GHz</th>
<th scope="col" abbr="Dual 2.5GHz">Dual 2GHz</th>
</tr>
<tr>
<th scope="row" class="spec">Model</th>
<td>M9454LL/A</td>
<td>M9455LL/A</td>
<td>M9457LL/A</td>
</tr>
...
http://veerle.duoh.com/index.php/blo..._styled_table/
|
|
06-16-2008, 08:27 PM
|
#5
|
Status: I'm new around here
Join date: Sep 2006
Location: US
Expertise: html, css, photoshop
Software: photoshop, notepad, wordpress
Posts: 22
|
Originally Posted by LeetPCUser
I wouldn't recommend tables unless you need to put tabulated data on your website. If you are trying to adhere to new standards and still making a site in a table, I would learn the benefits of CSS and re-code your site.
|
I wouldn't completely count on that. So far I have tested over 15 different layout methods using div/css and every single one has atleast one aweful flaw with cross browser compatibility. I would say that until browsers decide to stop warring against eachother over standards, dont be afraid to use tables to make Stable layouts that display more correctly for all browsers than divs will.
|
|
06-16-2008, 08:37 PM
|
#6
|
Status: Member
Join date: Aug 2006
Location: Wisconsin
Expertise:
Software:
Posts: 132
|
Ethan,
As long as you know how to correctly utilize CSS and the appropriate hacks it will look better than tables.
|
|
06-17-2008, 02:35 AM
|
#7
|
Status: Member
Join date: Oct 2006
Location: Australia
Expertise:
Software:
Posts: 297
|
Originally Posted by Ethan
I wouldn't completely count on that. So far I have tested over 15 different layout methods using div/css and every single one has atleast one aweful flaw with cross browser compatibility. I would say that until browsers decide to stop warring against eachother over standards, dont be afraid to use tables to make Stable layouts that display more correctly for all browsers than divs will.
|
I disagree wholeheartedly.
You have tested different methods. If its not done properly, then of course its not going to work.
Look at it this way. 95% of people use standards compliant browsers (well, standards enough)
For the sake of 5% of people (keeping in mind every other site they visit will look rubbish anyway) are you going to make your site have:
- Slow loading times
- Increased server load
- Decreased flexibility for changes
- Decreased search engine rankings due to excessive markup and not as much content
Of which, having slower loading times and lower search engine rankings will lose customers anyway - so making your site work for 5% extra people, and in turn losing more than 5% of business, is just stupid.
CSS for the win.
|
|
06-17-2008, 03:55 AM
|
#8
|
Status: I'm new around here
Join date: Jun 2008
Location:
Expertise:
Software:
Posts: 14
|
I sort of agree with CSS always will look better but for the newbee you should try sticking with tables as CSS would be a bit complicated to begin with. If you have a general understanding of CSS then go for it.
|
|
06-17-2008, 01:11 PM
|
#9
|
Status: Member
Join date: Aug 2006
Location: Wisconsin
Expertise:
Software:
Posts: 132
|
I started with CSS because I was told if you start with tables you are going to develop bad habits.
|
|
06-17-2008, 10:30 PM
|
#10
|
Status: I'm new around here
Join date: Sep 2006
Location: US
Expertise: html, css, photoshop
Software: photoshop, notepad, wordpress
Posts: 22
|
Originally Posted by rochow
I disagree wholeheartedly.
You have tested different methods. If its not done properly, then of course its not going to work.
Look at it this way. 95% of people use standards compliant browsers (well, standards enough)
For the sake of 5% of people (keeping in mind every other site they visit will look rubbish anyway) are you going to make your site have:
- Slow loading times
- Increased server load
- Decreased flexibility for changes
- Decreased search engine rankings due to excessive markup and not as much content
Of which, having slower loading times and lower search engine rankings will lose customers anyway - so making your site work for 5% extra people, and in turn losing more than 5% of business, is just stupid.
CSS for the win.
|
I was on that boat for a while, I went to college for web design and taught CSS to people myself. But it seems that I still come across instances (even simple ones), where even when I consult those who are even better than me with CSS (including this site as well), CSS with divs have failed stability.
Don't get me wrong, I prefer CSS in general over the majority of the point, yet CSS still has flaws concerning cross browser stability in many instances, not because CSS isnt better than tables, but because browsers and standards have not yet come full circle in making CSS/divs work together with them completely.
Also, don't get me as if I'm saying "defintely use tables, they are better", no, rather I'm saying, those little nicks where you can't seem to find any other solution, even from the experts, don't be afraid to use tables every now and then until standards and browsers do start cooperating better.
|
|
|
|
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
|