Home arrow HTML arrow Building a 3D HTML Table
HTML

Building a 3D HTML Table


In this article, the first one in a four-part series, I show you how you can create a three-dimensional HTML table. I assume you have basic knowledge of HTML, DOM and JavaScript.

Author Info:
By: Chrysanthus Forcha
Rating: 4 stars4 stars4 stars4 stars4 stars / 19
November 11, 2008
TABLE OF CONTENTS:
  1. · Building a 3D HTML Table
  2. · Demonstration
  3. · Open the File
  4. · Explanation of the Code

print this article
SEARCH DEVARTICLES

Building a 3D HTML Table
(Page 1 of 4 )

Description

The HTML table as defined in the HTML specification is a two-dimensional object. In other words, the specification does not define a 3D table. The 2D table defined works like this:


Cell, Cell, Cell, Cell, Cell

Cell, Cell, Cell, Cell, Cell

Cell, Cell, Cell, Cell, Cell

Cell, Cell, Cell, Cell, Cell

Cell, Cell, Cell, Cell, Cell

Cell, Cell, Cell, Cell, Cell


There are several ways you can create a 3D HTML table. I will show you the way I find most convenient. 

Now, you can decide to have only one HTML element and no text, as content for each of the above cells. That is:

Table, Table, Table, Table, Table

Table, Table, Table, Table, Table

Table, Table, Table, Table, Table

Table, Table, Table, Table, Table

Table, Table, Table, Table, Table

Table, Table, Table, Table, Table


Now, let us allow only one row for each of the tables above. That is


Row, Row, Row, Row, Row

Row, Row, Row, Row, Row

Row, Row, Row, Row, Row

Row, Row, Row, Row, Row

Row, Row, Row, Row, Row

Row, Row, Row, Row, Row


These rows are going into the page, forming the third dimension.

In the above illustrations (grids), there are six rows and five columns in what you are seeing.

So my 3D table is the normal 2D table where the content of each table cell is a one-row table. The 3D table consists of cells arranged in a 3D grid. It is the cells of the one-row tables that can take arbitrary content; each cell in the 2D table has only one item for its content, the one-row table.

Irregular 3D Table

The rows in the one-row tables can be of different lengths. If that is the case, the back of the 3D table will be irregular, so the 3D table as a whole will also be irregular.

Regular 3D Table

If the rows of the one-row tables are of the same length, then the back of the 3D table will be flat. In that case you will have a cuboid, a regular 3D table. For the rest of the article, I will talk about 3D tables that are cuboids. The size (number of cells) of such a table is given by

Y x X x Z

where Y is the number of rows in the 2D table, X is the number of columns in the 2D table and Z is the number of cells in each row in the one-row tables.

The Planes

The cells can be considered to be at the intersection points of the vertical and horizontal planes. The vertical planes I am referring to are the planes as seen from the front, placed one behind the other into the page.

Seeing Only One Plane at a Time

Even though we have a 3D table, we have but a 2D screen. Only the contents of one vertical plane should be seen at a time. For the contents of the planes whose cells are not seen, the cells are each given the value of "none" for the CSS display property. For the contents of the planes whose cells are seen, the cells are each given the value of "block" for the CSS display property.

Index Identifiers

There are no official identifiers for the indices (corresponding to Y, X, Z). I use i to identify any row in the 2D table, j to identify any column in the 2D table and k to identify any index of a cell in a one-row table.

IDs

The one-row tables must have IDs. The other elements in the 3D table do not need to have IDs. However, I have given IDs to all the elements in the example in this article. The IDs follow the order of the index identifiers (i, j, k) that I explained above.


blog comments powered by Disqus
HTML ARTICLES

- Does HTML5 Need a Main Element?
- Revisiting the HTML5 vs. Native Debate
- HTML5: Not for Phone Apps?
- HTML5 or Native?
- Job Hunting? Freelancer.com Lists This Quart...
- HTML5 in the News
- Report: HTML5 Mobile Performance Lags
- The Top HTML5 Audio Players
- Top HTML5 Video Tutorials
- HTML5: Reasons to Learn and Use It
- More of the Top Tutorials for HTML5 Forms
- MobileAppWizard Releases HTML5 App Builder
- HTML5 Boilerplate: Working with jQuery and M...
- HTML5 Boilerplate Introduction
- New API Platform for HTML5

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials