HTML and CSS Reference
In-Depth Information
Test drive the table
Make the changes to the table in “journal.
html” and give it a test run. Take a look at
the table. Think about exactly what you're
doing to the table: you're using HTML to
specify that certain cells should take up
more than one row, and to do that, you're
removing the <td> s they're displacing.
Now we've got a great-looking
table that doesn't have any
redundant information in it
and looks good too!
Q: You said you can have table data
span columns too?
A: You sure can. Just add a colspan
attribute to your <td> element and specify
the number of columns. Unlike the rowspan,
when you span columns, you remove table
data elements that are in the same row
(since you are spanning columns, not rows).
Q: Can I have a colspan and rowspan
in the same <td>?
A: You sure can. Just make sure you
adjust the other <td>s in the table to account
for both the row and column spans. In
other words, you'll need to remove the
corresponding number of <td>s from the
same row, and from the column.
Q: Do you really think these rowspans
look better?
A: Well, they certainly reduce the amount
of information in the table, which is usually a
good thing. And, if you look at a few tables
out there in the real world, you'll find that
rowspans and colspans are quite common,
so it's great to be able to do them in HTML.
But if you liked the table better before, feel
free to change your HTML and go back to
the previous version.
Search WWH ::

Custom Search