0

I'm working on constructing a table using only divs. I began creating the table using percentages to set column widths, but would prefer to just use table-cell and not have to worry about things that way. Only problem is I'm not guaranteed to have the same number of elements in every row.

http://jsfiddle.net/JWvLX/

This example shows what is currently happening in the top two rows, and what I want to happen if a cell is removed/not present in the bottom two rows.

What exactly do I need to do to accomplish this? Is this possible using only divs for tables or will I be forced to use actual tables to get the desired effect.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Crag
  • 458
  • 4
  • 14
  • Why are you making a table with divs? – Hawxby Feb 02 '11 at 20:40
  • @Beliskner: Because the world wide web for strange reasons hates `` to death. We moved from using tables for everything to being forbidden using tables for anything (including tables!).
    – 6502 Feb 02 '11 at 20:44
  • Call it an academic exercise if you want. I'm just messing around seeing what exactly I can and can't do with only divs and css (javascript if needed). – Crag Feb 02 '11 at 20:52
  • 3
    @6502: No one with a clue what they're talking about ever absolutely forbid the use of tables. The only people who did that were those who overreacted to standards advocates pushing for them to no longer be used for layout. They have their purposes, which they're perfectly acceptable to use for. – Su' Feb 02 '11 at 21:04
  • @Su': I agree completely. However there are still a few anti-table zealots around even when the layout you need is exactly a table. – 6502 Feb 02 '11 at 21:06
  • @6502: Tables are for rendering table data and should be used thereafter. Tables are not made for structuring layout and should not be used in that purpose. What's with the forbidding? – Alexander Wallin Feb 02 '11 at 21:08
  • Tables are fine for tabular data. Anyone who says they're not doesn't know what they're talking about and should immediately do some research. If however you are trying to remove table based layout then fine, we're here to help – Hawxby Feb 02 '11 at 21:24
  • See also http://stackoverflow.com/questions/4746061/div-table-colspan-how – Robert Harvey Feb 03 '11 at 04:09

1 Answers1

0

There's no equivalent for colspan/rowspan in CSS tables, but this Sitepoint post has some trickery you might be able to use.

Su'
  • 2,128
  • 20
  • 22