As it relates to HTML, tables are used to display data in a tabular fashion. Questions regarding HTML tables should be asked by showing the source-code one has problem with, or, if the question is about a failed attempt to create a table according to the desires, the asker needs to show the failed try, describe the expectations and how the behavior was different.
The
Like any HTML tag, the
border defines tables border thickness. ie border="1"
dir defines the direction of the table. ie dir="rtl" or
dir="ltr"
cellpadding defines space around a cell's content i.e. cellpadding="10"
cellspacing defines space around cells ie cellspacing="10"
Tables are divided into a number of subelements:
is the tile of the table. It's optional but if present it has to be the first tag after the,
, and will separate the table into their respective sections of header, body, and footer. Using these elements allows better semantic meaning for certain rows of the table, which may be titles to columns (in the header) or a total row (in the footer), rather than pushing everything into the body. If none of these are specified and the table immediately goes into rows, the browser will see it as all being contained within the body. starts a new row in the table. Table rows are not requiredto be closed by a
but it is recommended to do so in mostcases in order to avoid confusion. A table row will continue until a
new row is opened or the header, body, or footer which contains it is
closed. A table can contain any number of rows.
defines header cell within a row, This will contains theheader information/title, and can be decorated differently in the
table.
defines a Standard cell within a row, which contains somecontent/data. Like table rows, table cells are also not required
to be closed by a
. A table cell will continue until a newcell is opened or the row which contains it is closed. A table row
can contain any number of cells. Similarly, the
element isoften used inside the table header. It is an alternative to a regular
table cell which sets it aside from other cells as a defining point
that identifies the information below or to the side of it.
Also, the cells in a
code for rowspan:
Merged | Table First Row |
Table Second Row |
code for colspan:
Merged | |
Table First Col | Table Second Col |
code for no borders:
Merged | |
Table First Col | Table Second Col |
This tag is related to html.