Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Table cell
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Grouping within a chart table used for storing information or data}} {{multiple issues| {{cleanup|reason=Complete lack of context, HOWTO without background or explanation, technical errors|date=September 2013}} {{unreferenced|date=September 2013}} {{Context|date=February 2025}} }} A '''table cell''' is one grouping within a chart [[Table (information)|table]] used for storing information or data. Cells are grouped horizontally (rows of cells) and vertically (columns of cells). Each cell contains information relating to the combination of the row and column headings it is collinear with. In [[software design]], table cells are a key [[software component|component]] in [[HTML]] and [[webpage]] building, and it is part of the <nowiki><table></nowiki> component. A coder may specify dimensions for a table cell, and use them to hold sections of webpages. ==HTML usage== ===Kinds of cell in HTML=== A table cell in HTML is a non-empty element and should always be closed. There are two different kinds of table cell in HTML: normal table cell and header cell. '''<td>''' denotes a table cell, the name implying 'data', while '''<th>''' denotes a table 'header'. The two can be used interchangeably, but it is recommended that header cell be only used for the top and side headers of a table. ===Syntax=== A table cell also must be nested within a '''<table>''' tag ''and'' a '''<tr>''' (table row) tag. If there are more table cell tags in any given row than in any other, the particular '''<tr>''' must be given a {{mono|colspan}} attribute declaring how many columns of cells wide it should be. ===Example=== An example of an HTML table containing 4 cells: <table border="1"> <tr><td>Cell 1</td><td>Cell 2</td></tr> <tr><td>Cell 3</td><td>Cell 4</td></tr> </table> HTML source: <syntaxhighlight lang="html"> <table border="1"> <tr> <td> Cell 1 </td> <td> Cell 2 </td> </tr> <tr> <td> Cell 3 </td> <td> Cell 4 </td> </tr> </table> </syntaxhighlight> ===Colspan and rowspan=== Every row must have the same number of table data cells, occasionally table data cells have to span more than one column or row. In this case the tags colspan and/or rowspan are used - where they are set to a number. {| width="80%" align="center" style="font-variant:small-caps" |- | style="background:var(--background-color-inverted, black)" width="5%"|<br/> | style="background:var(--background-color-inverted, black)" width="5%"|<br/> | style="background:var(--background-color-inverted, black)" width="5%"|<br/> | border="none"|<-- ''This row has three'' '''table data cells''' |- | colspan="2" style="background:var(--background-color-progressive, blue);"|<br/> | style="background:var(--background-color-inverted, black)"|<br/> | border="none"|<-- ''This row has two. The first uses'' '''<code>colspan="2"</code>''' |- | rowspan="2" style="background:var(--background-color-destructive, red)"|<br/> | style="background:var(--background-color-inverted, black)"|<br/> | style="background:var(--background-color-inverted, black)"|<br/> | border="none"|<-- ''This row has three table data cells, but one spans two rows because it uses'' '''<code>rowspan="2"</code>''' |- | style="background:var(--background-color-inverted, black)"|<br/> | style="background:var(--background-color-inverted, black)"|<br/> | border="none"|<-- ''This row has only two table data cells, because its first is being taken up |} ==See also== *[[Wikipedia:How to use tables|Tables in Wikipedia pages]] *[[Table (HTML)]] ==External links== *[http://www.w3.org/TR/REC-html40/struct/tables.html#h-11.2.6 TH and TD elements] *[http://www.w3.org/wiki/HTML/Elements/td DHTML Reference: td] *[http://www.idocs.com/tags/tables/_TD.html TD Tag] [[Category:HTML tags]] [[Category:HTML]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Mono
(
edit
)
Template:Multiple issues
(
edit
)
Template:Short description
(
edit
)