Welcome to WebmasterWorld Guest from 3.80.60.248

Forum Moderators: open

Message Too Old, No Replies

Tables best practices

     
7:40 am on Aug 5, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:July 18, 2005
posts:157
votes: 0


I haven't worked much with tables in a while, but this last week I have been freshing up some projects for a client and there's been a lot of tables. I've seen this thing so many times that I no longer know what's right...

So, basically my question is; in XHTML, which is the correct out of these two?

<td>Some text</td>
<td><p>Some text</p></td>

The table is used for tabular data, but product names and such are text inside it. I've never used the <td><p></p></td> way before, but I'm starting to wonder if it is more semantically correct?

8:08 am on Aug 5, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Oct 23, 2003
posts:165
votes: 0


I think it depends on how much data is in the table. sometimes lists may belong inside a table cell and sometimes multiple paragraphs.

However, if only a single piece of text or a few words exist inside the cell, then there should be no extra HTML.
eg


<td><p>lots of texts goes here</p>
<p>even more text here</p></td>

or


<td>text</td>
8:23 am on Aug 5, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Feb 1, 2005
posts:158
votes: 0


I always wrap text in a paragraph - mainly as I give visitors the ability to control the font used to render tha page (good for poor eyesight) and they are set within the p tag.

That is just a personal development point though.

8:57 am on Aug 5, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:July 18, 2005
posts:157
votes: 0


Thanks for the input. I have used lists and paragraphs inside tables too, when there's enough content to do so. I guess my question actually was "should I always wrap table cell text in a <p>?" In which one of you answered yes and one no :) More views on this?
10:06 am on Aug 5, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Dec 13, 2004
posts:121
votes: 0


cellarnews: Your point about resizing the text surprised me. So I just tried it using IE 6 & Firefox - using view--> text size in the browser.

It resized the text both with a paragraph tag and without one, not sure about older browser though.

10:09 am on Aug 5, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:May 26, 2000
posts:37301
votes: 0


How about a nearly idiot opinion - use <p> when you have a paragrapgh. Don't use any extra container element if you just have "some text" - which is pretty common with tabular data.
10:48 am on Aug 5, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Feb 1, 2005
posts:158
votes: 0


cellarnews: Your point about resizing the text surprised me. So I just tried it using IE 6 & Firefox - using view--> text size in the browser.

Many general users do not know about that option in their web browser, so we have a dynamic CSS facility on our site that enables the user to click on a series of larger/smaller letters to permenently set our sites to a font size they prefer.

Also - a lot of sites lock their CSS so that the browser resize doesn't work - leading people to abandon using it.

I read one web major news site where the font is tiny and locked - the only way to read the page is to disable the browser setting completly, which also then makes the page look awful as none of the formatting loads.

8:13 pm on Aug 5, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:June 9, 2003
posts:1908
votes: 0


Firefox will resize text no matter how it's formatted or styled, or what the size units are. Try going back to that news site in Firefox, then hold down the CTRL key and roll your mouse wheel. You can make the text about as big or small as you could want.
10:01 pm on Aug 5, 2005 (gmt 0)

Full Member

10+ Year Member

joined:June 16, 2004
posts:232
votes: 0


wow neat..thanks MatthewHSE
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members