{"id":60,"date":"2022-03-19T09:56:53","date_gmt":"2022-03-19T09:56:53","guid":{"rendered":"https:\/\/staging.brightwhiz.com\/?post_type=topic&p=60"},"modified":"2022-03-19T09:56:53","modified_gmt":"2022-03-19T09:56:53","slug":"html-tables","status":"publish","type":"topic","link":"http:\/\/local.tutorials\/topic\/html-tables\/","title":{"rendered":"HTML – Tables"},"content":{"rendered":"\n
HTML tables are used to arrange HTML-supported data into rows and columns of cells.<\/p>\n\n\n\n
HTML tables are created using the Example:<\/p>\n\n\n\n The above code will produce a table such as this:<\/p>\n\n\n\n We’ve used the border attribute to give the table and cells a border of 1 pixel.<\/p>\n\n\n\n You can use the Example<\/p>\n\n\n\n This HTML table uses table headings on the first row.<\/p>\n\n\n\n The above code will produce a table such as this:<\/p>\n\n\n\n Use the width and height attributes to set the table size. The dimensions can be set using either pixels or a percentage of the available screen area.<\/p>\n\n\n\n You can set table background color and border color using one of the following attributes depending on what you want to achieve.<\/p>\n\n\n\n Note <\/strong>\u2212 The You can use the following attributes to control white space within and surrounding cells. The value of these attributes is in pixes.<\/p>\n\n\n\n The above code will produce a table such as this:<\/p>\n\n\n\n You can use the following attributes in the Example<\/p>\n\n\n\n colspan and rowspan attributes usage:<\/p>\n\n\n\n The above code will produce a table such as this:<\/p>\n\n\n\n HTML tables can be divided into three logical sections namely a header, a body, and a footer.<\/p>\n\n\n\n The three elements for sectioning the header, body, and footer of a table are:<\/p>\n\n\n\n The content within the Example<\/p>\n\n\n\n Table showing the use of The above code will produce a table such as this:<\/p>\n\n\n\n Tables can be nested within other tables as long as the child table is placed inside a Example<\/p>\n\n\n\n HTML tables are used to arrange HTML-supported data into rows and columns of cells. HTML tables are created using the <table> tag. Within the tags, you typically use the <tr> tag to create table rows. Tr stands for table row. Inside the <tr> tag, you can use the <td> tag to create data cells. Td […]<\/p>\n","protected":false},"featured_media":43,"comment_status":"open","ping_status":"closed","template":"","meta":[],"categories":[2],"tags":[],"subject":[7,8],"yoast_head":"\n<table><\/code> tag. Within the tags, you typically use the
<tr><\/code> tag to create table rows. Tr stands for table row. Inside the
<tr><\/code> tag, you can use the
<td><\/code> tag to create data cells. Td stands for table data. The content is placed under the
<td><\/code> tag.<\/p>\n\n\n\n
<!DOCTYPE html>\n<html>\n <head>\n <title>HTML Tables Example<\/title>\n <\/head>\n <body>\n <table border="1">\n <tr>\n <td>Row 1, Column 1<\/td>\n <td>Row 1, Column 2<\/td>\n <td>Row 1, Column 3<\/td>\n <\/tr>\n <tr>\n <td>Row 2, Column 1<\/td>\n <td>Row 2, Column 2<\/td>\n <td>Row 2, Column 3<\/td>\n <\/tr>\n <tr>\n <td>Row 3, Column 1<\/td>\n <td>Row 3, Column 2<\/td>\n <td>Row 3, Column 3<\/td>\n <\/tr>\n <\/table>\n \n <\/body>\n<\/html><\/code><\/pre>\n\n\n\n
Row 1, Column 1<\/td> Row 1, Column 2<\/td> Row 1, Column 3<\/td><\/tr> Row 2, Column 1<\/td> Row 2, Column 2<\/td> Row 2, Column 3<\/td><\/tr> Row 3, Column 1<\/td> Row 3, Column 2<\/td> Row 3, Column 3<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n Table Heading<\/h2>\n\n\n\n
<th><\/code> tag to define a table heading.
<th><\/code> tags replace
<td><\/code> tags in rows where you want to specify a heading. Typically they would be used on the first row even though they can appear on any row.<\/p>\n\n\n\n
<table>\n <tr>\n <th>Company<\/th>\n <th>Owner<\/th>\n <th>Country<\/th>\n <\/tr>\n <tr>\n <td>Acme Corporation<\/td>\n <td>Martin Acmes<\/td>\n <td>England<\/td>\n <\/tr>\n <tr>\n <td>Merlin Fisheries<\/td>\n <td>Peter Chenney<\/td>\n <td>Australia<\/td>\n <\/tr>\n <tr>\n <td>Max Agri Tools<\/td>\n <td>Fred Hammad<\/td>\n <td>United States<\/td>\n <\/tr>\n<\/table><\/code><\/pre>\n\n\n\n
Company<\/th> Owner<\/th> Country<\/th><\/tr> Acme Corporation<\/td> Martin Acmes<\/td> England<\/td><\/tr> Merlin Fisheries<\/td> Peter Chenney<\/td> Australia<\/td><\/tr> Max Agri Tools<\/td> Fred Hammad<\/td> United States<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n Table Height and Width<\/h2>\n\n\n\n
<table border="1" width="480" height="320">\n ...\n<\/table><\/code><\/pre>\n\n\n\n
Table Background and Border Color<\/h2>\n\n\n\n
bgcolor<\/code>,
background<\/code>, and
bordercolor<\/code> attributes were deprecated in HTML5. Do not use these attributes. Instead, use the
style<\/code> attribute or external CSS styles.<\/p>\n\n\n\n
Cell Padding and Cell Spacing<\/h2>\n\n\n\n
<td><\/code> tag to set the white space between the content and the edge of the cell<\/li>
<td><\/code> tag to set the white space between surrounding cells<\/li><\/ul>\n\n\n\n
<table border="1" cellpadding="7" cellspacing="7">\n <tr>\n <th>Name<\/th>\n <th>Age<\/th>\n <\/tr>\n <tr>\n <td>Zawadi Amani<\/td>\n <td>50<\/td>\n <\/tr>\n <tr>\n <td>Mumbi Gichui<\/td>\n <td>35<\/td>\n <\/tr>\n<\/table><\/code><\/pre>\n\n\n\n
Name<\/th> Age<\/th><\/tr> Zawadi Amani<\/td> 50<\/td><\/tr> Mumbi Gichui<\/td> 35<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n Column Spans and Row Spans<\/h2>\n\n\n\n
<td><\/code> tags as follows:<\/p>\n\n\n\n
<table border="1">\n <tr>\n <th>Column 1<\/th>\n <th>Column 2<\/th>\n <th>Column 3<\/th>\n <\/tr>\n <tr>\n <td colspan="3">Row 1 Cell 1<\/td>\n <\/tr>\n <tr>\n <td rowspan="2">Row 2 Cell 1<\/td>\n <td>Row 2 Cell 2<\/td>\n <td>Row 2 Cell 3<\/td>\n <\/tr>\n <tr>\n <td>Row 3 Cell 2<\/td>\n <td>Row 3 Cell 3<\/td>\n <\/tr>\n<\/table><\/code><\/pre>\n\n\n\n
Column 1<\/th> Column 2<\/th> Column 3<\/th><\/tr> Row 1 Cell 1<\/td><\/tr> Row 2 Cell 1<\/td> Row 2 Cell 2<\/td> Row 2 Cell 3<\/td><\/tr> Row 3 Cell 2<\/td> Row 3 Cell 3<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n Table Header, Body, and Footer<\/h2>\n\n\n\n
<thead><\/code> \u2212 used to create a separate table header.<\/li>
<tbody><\/code> \u2212 used to indicate the main body of the table.<\/li>
<tfoot><\/code> \u2212 used to create a separate table footer.<\/li><\/ul>\n\n\n\n
<thead><\/code> is always displayed at the top of the table while the content within the <tfoot> tag is always at the end of the table. These tags work similarly to the header and footer of a Word Processor where the content in those sections is displayed on every page. A table can have more than one
<tbody><\/code> tag. These can act as different pages or groups of data.<\/p>\n\n\n\n
<thead><\/code>,
<tbody><\/code>,
<tfoot><\/code> tags:<\/p>\n\n\n\n
<table>\n <thead>\n <tr>\n <th colspan="2">This is the table header<\/th> \n <\/tr>\n <\/thead>\n\n <tfoot>\n <tr>\n <td colspan="2">This is the table footer<\/td> \n <\/tr>\n <\/tfoot>\n\n <tbody>\n <tr>\n <td>January<\/td>\n <td>$100<\/td>\n <\/tr>\n <tr>\n <td>February<\/td>\n <td>$80<\/td>\n <\/tr>\n <\/tbody>\n<\/table><\/code><\/pre>\n\n\n\n
This is the table header<\/th><\/tr><\/thead> January<\/td> $100<\/td><\/tr> February<\/td> $80<\/td><\/tr><\/tbody> This is the table footer<\/td><\/tr><\/tfoot><\/table><\/figure>\n\n\n\n Nested Tables<\/h2>\n\n\n\n
<td><\/code> tag.<\/p>\n\n\n\n
<table border="1" width="100%">\n <tr>\n <td>Column 1<\/td>\n <td>Column 2<\/td>\n <\/tr>\n <tr>\n <td colspan="2">\n <table border = "1" width = "100%">\n <tr>\n <th>Month<\/th>\n <th>Profit<\/th>\n <\/tr>\n <tr>\n <td>January<\/td>\n <td>$5000<\/td>\n <\/tr>\n <tr>\n <td>February<\/td>\n <td>$7000<\/td>\n <\/tr>\n <\/table>\n <\/td>\n <\/tr>\n<\/table><\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"