Forum Moderators: open

Message Too Old, No Replies

Using Tables or Divs in XHTML

Does it always matter?

         

Gusgsm

11:07 am on May 26, 2003 (gmt 0)

10+ Year Member



Good morning, folks

I have a tiny place which I migrated to xhtml 1.1 some time ago. The site validates all right (but two pages that I left as "xhtml 1.0 transitional" because the lack of support of some CSS2 options in the actual browsers), but...

The question is: I have some "example pictures" that have captions below them to explain what is going on. When there's only one caption and one picture, I use a general div that englobes two divs: One for the picture and one for the caption. The effect is nice and it's simple to use.

However, the trouble comes when I have two or more pictures forming a "conceptual group" and each one has a caption. Then I have resorted to a table. But I feel this is a somehow old use of the table tag (ie: pre xhtml) and that I should be using a bunch of divs...

What do you think? Does it matter?

PS: Besides there are some differences in the rendering (the div achieves having a nice 1 pixel border, the table is always thicker). I'm using Explorer 6.

korkus2000

2:59 pm on May 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Are you concerned that the table isn't supported?

Gusgsm

4:24 pm on May 26, 2003 (gmt 0)

10+ Year Member



No. It's supported (validated at W3C). What somehow troubles me is that I'm not using a table for true tabular data. So, in a not so distant future I might be forced to change this code into some other code.

I'm trying to avoid it. But I'm not sure if I am overworrying a bit, if you understand me ;).

papabaer

5:07 pm on May 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Gusgsm, what you are concerned with is not so much XHTML proper, but rather XHTML/CSS working in unison flavored with usability and accessility considerations, sprinkled with a dose of the Semantic Web. Confused? Don't fret.. or feel bad. you are not alone by a long shot!

At the core of your consternation is the underlying question that asks: "Should I be using a table element as a layout device?" The answer, is simple: No.

But can tables be styled and designed to fascillitate and enhance "tabular data?" Absolutely!

Visit the CSS forum for a number of related discussions on this matter.

Best of luck!
- papabaer

Gusgsm

9:01 pm on May 26, 2003 (gmt 0)

10+ Year Member



And I thought I was just worrying about a tag! ;)

Thanks a lot, papabaer, I'll do that.

lorax

2:22 pm on May 27, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



"Should I be using a table element as a layout device?" The answer, is simple: No.

I'm going to be a stick in the mud PB. ;)

What do you mean by "layout device"? A framework to hold visual parts and pieces used to build the structure of the page? My point is that tables make perfect sense sometimes as containers for certain content especially where using CSS becomes too cumbersome. This is a form of "layout device" though I'm not sure you intended to include it. But using tables as the framework for the structure of the page - I shy away from most definately.