The Wayback Machine - https://web.archive.org/web/20081201152027/http://www.webreference.com/html/tutorial11/4.html


spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

Trials and Tabulations

Splitting Up Tables Continued


Developer News
Mandrake Linux Founder Back, Virtually
Amazon: We're a Technology Company
Sun Expands MySQL With Closed Source

Row and Column Spans, Empty Cells

Sometimes a simple grid is not sufficient to display data in the table, and you might want cells that span more than one row or column. Also, you might want certain cells in your table to be skipped completely.

The first problem is addressed by the COLSPAN and ROWSPAN attributes to table cells. These attributes have a default value of 1 and indicate how many rows or columns a cell occupies.

You an also leave cells empty. If a cell has no contents except white space, it is not rendered at all, but space is allocated for it on the table. In this case it is called an empty cell. Also, if a row has fewer cells than the table has columns, the remainder of the row is filled with empty cells. The following table illustrates this. I've used the BORDER attribute, which we'll discuss later, to make the edges of table cells more obvious; don't worry about it just yet.

<TABLE BORDER>
<TR>
<TD COLSPAN=2>I span two columns</TD>
<TD>I'm plain</TD>
</TR>
<TR>
<TD>I'm plain</TD>
<TD ROWSPAN=3 COLSPAN=2>I span 3 rows and two columns</TD>
</TR>
<TR>
<TD></TD>
</TR>
<TR>
<TD>I'm plain</TD>
</TR>
<TR>
<TD>I'm plain</TD>
<TD>I'm plain</TD>
</TR>
</TABLE>
I span two columns I'm plain
I'm plain I span 3 rows and two columns
I'm plain
I'm plain I'm plain

Row Groups

Just like columns can be grouped, so can rows. Each table can have one table header, one table footer, and one or more table bodies, represented by the THEAD, TFOOT and TBODY elements respectively.

Normally, the order that these are given in the document is first THEAD, then TFOOT and then the various TBODY's. Here's our table, with row groups:

<TABLE>
<THEAD>
<TR>
 <TD>Day</TD><TD>Month</TD><TD>Year</TD>
 <TD>Arnold</TD><TD>Bob</TD><TD>Carla</TD><TD>Daphne</TD><TD>Eric</TD>
 <TD>Total</TD><TD>Change</TD>
</TR>
</THEAD>
<TFOOT>
<TR>
 <TD COLSPAN=3>Total</TD>
 <TD>60</TD><TD>104</TD><TD>20</TD><TD>242</TD><TD>7</TD>
 <TD>453</TD>
</TR>
</TFOOT>
<TBODY>
<TR>
 <TD>16</TD><TD>January</TD><TD>1999</TD>
 <TD>34</TD><TD>56</TD><TD>12</TD><TD>144</TD><TD>5</TD>
 <TD>251</TD><TD>+27</TD>
</TR>
<TR>
 <TD>17</TD><TD>January</TD><TD>1999</TD>
 <TD>26</TD><TD>48</TD><TD>8</TD><TD>98</TD><TD>2</TD>
 <TD>182</TD><TD>-69</TD>
</TR>
</TBODY>
</TABLE>

The above example will also crash some Navigator 4 versions if combined with CSS, so I've moved it to a separate page. Users of Internet Explorer 4.0 will see the table footer at the end of the table, where it's supposed to be. Navigator ignores row groups, so displays table rows in the order that they are specified. A table footer should be before the actual data in the table becuase it can be displayed even before all the data in the table is downloaded, since there might be hundreds of rows in the table. In practice, it is a good idea to put the footer at the end of the table so that browsers that don't support row groups (which includes earlier versions of Internet Explorer) display the table correctly.

Front Page123456789

Produced by Stephanos Piperoglou

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Copyright 2008 Jupitermedia Corporation All Rights Reserved.

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Whitepapers and eBooks

Intel Whitepaper: Comparing Two- and Four-Socket Platforms for Server Virtualization
IBM Solutions Brief: Go Green With IBM System xTM And Intel
HP eBook: Simplifying SQL Server Management
IBM Contest: Are You the Next Superstar? Join the "Search for the XML Superstar" Contest to Find Out
Microsoft PDF: Top 10 Reasons to Move to Server Virtualization with Hyper-V
Microsoft PDF: Six Reasons Why Microsoft's Hyper-V Will Overtake Vmware
Microsoft Step-by-Step Guide: Hyper-V and Failover Clustering
Intel PDF: Quad-Core Impacts More Than the Data Center
Intel PDF: Virtualization Delivers Data Center Efficiency
Go Parallel Article: PDC 2008 in Review
Microsoft PDF: Top 11 Reasons to Upgrade to Windows Server 2008
Avaya Article: Communication-Enabled Mashups: Empowering Both Business Owners and IT
Intel Whitepaper: Building a Real-World Model to Assess Virtualization Platforms
  PDF: Intel Centrino Duo Processor Technology with Intel Core2 Duo Processor
Microsoft Article: Build and Run Virtual Machines with Hyper-V Server 2008
Go Parallel Article: Q&A; with a TBB Junkie
IBM Whitepaper: Innovative Collaboration to Advance Your Business
Internet.com eBook: Real Life Rails
IBM eBook: The Pros and Cons of Outsourcing
Internet.com eBook: Best Practices for Developing a Web Site
IBM CXO Whitepaper: The 2008 Global CEO Study "The Enterprise of the Future"
Avaya Article: Call Control XML in Action - A CCXML Auto Attendant
IBM CXO Whitepaper: Unlocking the DNA of the Adaptable Workforce--The Global Human Capital Study 2008
Adobe Acrobat Connect Pro: Web Conferencing and eLearning Whitepapers
HP eBook: Guide to Storage Networking
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
webref The latest from WebReference.com Browse >
Popular JavaScript Framework Libraries: An Overview - Part 3 · Accessing Your MySQL Database from the Web with PHP · Working with the DOM Stylesheets Collection
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Crucial Triples Up With New Three-Channel DDR3 Kits · Meet the Finalists: Excellence in Technology Awards · Tealeaf Offers Insight to Mobile Customer Behavior

URL: http://www.webreference.com/html/tutorial11/4.html
Created: Feb 10, 1998
Revised: Feb 16, 1999

Morty Proxy This is a proxified and sanitized view of the page, visit original site.