Mimic Colspan With Multiple Tables

Description

You can stack multiple "advanced tables" on top of each other to mimic "colspan" and achieve some complex layouts with your tables.

Code

[[table style="margin: 0 0px; width: 100%"]]
[[row]]
[[cell style="padding: 10px; background-color: #EAE3C5; border: 1px solid silver; width: 100%;"]]
+++ single cell in its own table, 100% width
content...
[[/cell]]
[[/row]]
[[/table]]
[[table style="margin: 0 0px; width: 100%"]]
[[row]]
[[cell style="padding: 10px; background-color: #DDEEDD; border: 1px solid silver; width: 33%;"]]
+++ another cell in a new table at 33% width
content...
[[/cell]]
[[cell style="padding: 10px; background-color: #DDDDEE; border: 1px solid silver width: 67%;"]]
+++ Flickr Gallery module inside in another cell at 67% width
[[module FlickrGallery tags="linux,sun" tagMode="all" perPage="6" limit="12" limitPages="1"]]
[[/cell]]
[[/row]]
[[/table]]
[[table style="margin: 0 0px; width: 100%"]]
[[row]]
[[cell style="padding: 10px; background-color: #EAE3C5; border: 1px solid silver; width: 20%;"]]
+++ new table, cell at 20% width
content...
[[/cell]]
[[cell style="padding: 10px; background-color: #DDDDEE; border: 1px solid silver; width: 50%;"]]
+++ middle cell, 50% width
content...
[[/cell]]
[[cell style="padding: 10px; background-color: #EEDDDD; border: 1px solid silver; width: 30%;"]]
+++ same row, cell at 30% width
content...
[[/cell]]
[[/row]]
[[/table]]

Note that you have to set the table margins to zero to achieve this look.
You can also adjust the cell widths individually for each row to create more complex layouts.

You may not get the results you expect unless you also set the width in the [[table]] command.
For example: [[table style="margin: 0 0px; width: 100%"]]


This was all figured out via trial and error, so if there's a better way, let us know!

In action

single cell in its own table, 100% width

Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Quisque facilisis erat a dui. Nam malesuada…

another cell in a new table at 33% width

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi commodo, ipsum sed pharetra gravida, orci magna rhoncus neque, id pulvinar odio lorem non turpis. Nullam sit amet enim. Suspendisse id…

(Shamelessly borrowing from another snippet! Thanks for showing us this!)

Flickr Gallery module inside in another cell at 67% width

new table, cell at 20% width

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi commodo, ipsum sed pharetra gravida, orci magna rhoncus neque, id pulvinar odio lorem non turpis. Nullam sit amet enim. Suspendisse id…

middle cell, 50% width

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi commodo, ipsum sed pharetra gravida, orci magna rhoncus neque, id pulvinar odio lorem non turpis. Nullam sit amet enim. Suspendisse id…

same row, cell at 30% width

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi commodo, ipsum sed pharetra gravida, orci magna rhoncus neque, id pulvinar odio lorem non turpis. Nullam sit amet enim. Suspendisse id…

Rate this solution

If you think this solution is useful — rate it up! Or dump it otherwise.

rating: +32+x
page tags: colspan column span tables
page_revision: 1, last_edited: 1217320682|%e %b %Y, %H:%M %Z (%O ago)
Unless stated otherwise Content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License