{"id":2818,"date":"2019-06-09T21:32:01","date_gmt":"2019-06-09T21:32:01","guid":{"rendered":"http:\/\/softlect.in\/?p=2818"},"modified":"2020-04-09T12:06:15","modified_gmt":"2020-04-09T12:06:15","slug":"html-table-tags","status":"publish","type":"post","link":"http:\/\/softlect.com\/index.php\/html-table-tags\/","title":{"rendered":"HTML Table Tags"},"content":{"rendered":"\n<div class=\"wp-container-2 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<h2>Tags for Tables<\/h2>\n\n\n\n<p>Tables can be created in HTML using <strong>&lt;table&gt;<\/strong> tag. In HTML table is a section of information broken into columns and rows of blocks called cells. The table &lt;table&gt; tag is the container for other table-related tags to create a table. The &lt;table&gt; tag itself will not create a table, it&#8217;s only a container. After defining a table, rows must be created and content or data for each cell must be assigned. The tags used for creating rows and cell data are illustrated below:<\/p>\n\n\n\n<p><strong>&lt;tr&gt;<\/strong> &#8211; tags is used to create table row<br><strong>&lt;td&gt;<\/strong> &#8211; tag is used for table data and holds the actual content for the cells<br><strong>&lt;th&gt;<\/strong> &#8211; tag is used as table header containing header information<\/p>\n\n\n\n<p>The table cells can contain text content as well as images. The table &lt;table&gt; tag has an attribute border, through which table border can be defined. For example, let us consider the following table to be created in HTML:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"http:\/\/softlect.in\/wp-content\/uploads\/HTMLIntroduction\/HTML-Image-Table.png\"><img loading=\"lazy\" width=\"1182\" height=\"415\" src=\"http:\/\/softlect.in\/wp-content\/uploads\/HTMLIntroduction\/HTML-Image-Table.png\" alt=\"Table\" class=\"wp-image-2490\" srcset=\"http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/HTML-Image-Table.png 1182w, http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/HTML-Image-Table-300x105.png 300w, http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/HTML-Image-Table-768x270.png 768w, http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/HTML-Image-Table-1024x360.png 1024w\" sizes=\"(max-width: 1182px) 100vw, 1182px\" \/><\/a><\/figure><\/div>\n\n\n\n<p>The HTML code given below demonstrates the creating of the above&nbsp;table. In line 7, &lt;table&gt; tag contains &#8220;border&#8221; attribute with value as &#8220;1&#8221;, which signifies that the table cells will have the border with width as &#8220;1&#8221;.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"html\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"true\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;html>\n  &lt;head>\n    &lt;title>Table Tag&lt;\/title>\n  &lt;\/head>\n  &lt;body>\n    &lt;p>This is the demonstration of displaying Tables&lt;\/p>\n    &lt;table border=\"1\">\n      &lt;tr>\n        &lt;td>S.No&lt;\/td>\n        &lt;td>Name&lt;\/td>\n        &lt;td>Amount&lt;\/td>\n      &lt;\/tr>\n      &lt;tr>\n        &lt;td>101&lt;\/td>\n        &lt;td>aaa&lt;\/td>\n        &lt;td>12,256&lt;\/td>\n      &lt;\/tr>\n      &lt;tr>\n        &lt;td>102&lt;\/td>\n        &lt;td>bbb&lt;\/td>\n        &lt;td>8,256&lt;\/td>\n      &lt;\/tr>\n      &lt;tr>\n        &lt;td>103&lt;\/td>\n        &lt;td>ccc&lt;\/td>\n        &lt;td>24,525&lt;\/td>\n      &lt;\/tr>\n    &lt;\/table>\n  &lt;\/body>\n&lt;\/html><\/pre>\n\n\n\n<div class=\"wp-container-1 wp-block-group\"><div class=\"wp-block-group__inner-container\"><\/div><\/div>\n\n\n\n<p>The output of the above HTML code is shown below:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"http:\/\/softlect.in\/wp-content\/uploads\/HTMLIntroduction\/30.-Table-Tag-Output.png\"><img loading=\"lazy\" width=\"855\" height=\"531\" src=\"http:\/\/softlect.in\/wp-content\/uploads\/HTMLIntroduction\/30.-Table-Tag-Output.png\" alt=\"\" class=\"wp-image-2553\" srcset=\"http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/30.-Table-Tag-Output.png 855w, http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/30.-Table-Tag-Output-300x186.png 300w, http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/30.-Table-Tag-Output-768x477.png 768w\" sizes=\"(max-width: 855px) 100vw, 855px\" \/><\/a><\/figure><\/div>\n\n\n\n<p class=\"has-text-color has-normal-font-size has-luminous-vivid-orange-color\"><strong>The video below demonstrates the complete working of HTML table tags<\/strong><\/p>\n\n\n\n<center><iframe loading=\"lazy\" src=\"https:\/\/www.youtube.com\/embed\/0yVBxnHs2OY\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/center>\n\n\n\n<center><strong>Video: HTML Table Tags<\/strong><\/center>\n\n\n\n<p>In the above example, we observe that the width of the table is dynamically adjusted according to the length of the content in the table cells. The &lt;table&gt;, &lt;tr&gt;, &lt;td&gt;, and &lt;th&gt; tags have attribute to adjust the width of table, cells and headers. For example:<br>&lt;table width=&#8221;300px&#8221; &gt;<br>&lt;table width=&#8221;80%&#8221; &gt;<br>&lt;td width=&#8221;80%&#8221; &gt;<br>&lt;th width=&#8221;80%&#8221; &gt;<br>The attribute with can have values as pixels or percentage.<\/p>\n\n\n\n<p>Let us apply the width attribute and also consider the use of &lt;th&gt; tag for demonstrating the table headers to be created in HTML for the below table:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"http:\/\/softlect.in\/wp-content\/uploads\/HTMLIntroduction\/HTML-Image-Table-Header.png\"><img loading=\"lazy\" width=\"1150\" height=\"411\" src=\"http:\/\/softlect.in\/wp-content\/uploads\/HTMLIntroduction\/HTML-Image-Table-Header.png\" alt=\"Table Header\" class=\"wp-image-2492\" srcset=\"http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/HTML-Image-Table-Header.png 1150w, http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/HTML-Image-Table-Header-300x107.png 300w, http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/HTML-Image-Table-Header-768x274.png 768w, http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/HTML-Image-Table-Header-1024x366.png 1024w\" sizes=\"(max-width: 1150px) 100vw, 1150px\" \/><\/a><\/figure><\/div>\n\n\n\n<p>The HTML code given below shows the demonstration of &lt;th&gt; tag in line 9 to line 11:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"html\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"true\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;html>\n  &lt;head>\n    &lt;title>Table Tag with Header&lt;\/title>\n  &lt;\/head>\n  &lt;body>\n    &lt;p>This is the demonstration of displaying Tables with Header&lt;\/p>\n    &lt;table border=\"1\" width=\"60%\">\n      &lt;tr>\n        &lt;th>S.No&lt;\/th>\n        &lt;th>Name&lt;\/th>\n        &lt;th>Amount&lt;\/th>\n      &lt;\/tr>\n      &lt;tr>\n      &lt;td>101&lt;\/td>\n        &lt;td>aaa&lt;\/td>\n        &lt;td>12,256&lt;\/td>\n        &lt;\/tr>\n      &lt;tr>\n        &lt;td>102&lt;\/td>\n        &lt;td>bbb&lt;\/td>\n        &lt;td>8,256&lt;\/td>\n      &lt;\/tr>\n      &lt;tr>\n        &lt;td>103&lt;\/td>\n        &lt;td>ccc&lt;\/td>\n        &lt;td>24,525&lt;\/td>\n      &lt;\/tr>\n    &lt;\/table>\n  &lt;\/body>\n&lt;\/html>\n<\/pre>\n\n\n\n<p>HTML code in line 7, the &lt;table&gt; tag also consist of width attribute which is set at &#8220;60%&#8221;. The output of the above HTML code is shown below where the width of the table is 60% of the web browser width along with the first row as headings.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"http:\/\/softlect.in\/wp-content\/uploads\/HTMLIntroduction\/32.-Table-Tag-with-Header-Output.png\"><img loading=\"lazy\" width=\"855\" height=\"531\" src=\"http:\/\/softlect.in\/wp-content\/uploads\/HTMLIntroduction\/32.-Table-Tag-with-Header-Output.png\" alt=\"\" class=\"wp-image-2557\" srcset=\"http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/32.-Table-Tag-with-Header-Output.png 855w, http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/32.-Table-Tag-with-Header-Output-300x186.png 300w, http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/32.-Table-Tag-with-Header-Output-768x477.png 768w\" sizes=\"(max-width: 855px) 100vw, 855px\" \/><\/a><\/figure><\/div>\n\n\n\n<p>Sometimes there may be need to change the amount of space between content and the edge of the cell, this is done through cellpadding attribute. For example: &lt;table cellpadding=&#8221;10&#8243; &gt; this tag apply 10 pixel of space between the content and the edge of the cell. The HTML code to demonstrate the use of cellpadding is given below:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"html\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;html>\n  &lt;head>\n    &lt;title>Table Tag Cellpadding&lt;\/title>\n  &lt;\/head>\n  &lt;body>\n    &lt;p>This is the demonstration of displaying Tables with cellpadding Attribute&lt;\/p>\n    &lt;table border=\"1\" width=\"60%\" cellpadding=\"10\">\n      &lt;tr>\n        &lt;td>S.No&lt;\/td>\n        &lt;td>Name&lt;\/td>\n        &lt;td>Amount&lt;\/td>\n      &lt;\/tr>\n      &lt;tr>\n        &lt;td>101&lt;\/td>\n        &lt;td>aaa&lt;\/td>\n        &lt;td>12,256&lt;\/td>\n      &lt;\/tr>\n      &lt;tr>\n        &lt;td>102&lt;\/td>\n        &lt;td>bbb&lt;\/td>\n        &lt;td>8,256&lt;\/td>\n      &lt;\/tr>\n      &lt;tr>\n        &lt;td>103&lt;\/td>\n        &lt;td>ccc&lt;\/td>\n        &lt;td>24,525&lt;\/td>\n      &lt;\/tr>\n    &lt;\/table>\n  &lt;\/body>\n&lt;\/html><\/pre>\n\n\n\n<p>The output of the above HTML code for demonstrating cellpadding is shown below:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"http:\/\/softlect.in\/wp-content\/uploads\/HTMLIntroduction\/33.-Table-Tag-Cellpadding-Output.png\"><img loading=\"lazy\" width=\"855\" height=\"531\" src=\"http:\/\/softlect.in\/wp-content\/uploads\/HTMLIntroduction\/33.-Table-Tag-Cellpadding-Output.png\" alt=\"\" class=\"wp-image-2559\" srcset=\"http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/33.-Table-Tag-Cellpadding-Output.png 855w, http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/33.-Table-Tag-Cellpadding-Output-300x186.png 300w, http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/33.-Table-Tag-Cellpadding-Output-768x477.png 768w\" sizes=\"(max-width: 855px) 100vw, 855px\" \/><\/a><\/figure><\/div>\n\n\n\n<p>Sometimes there may also be need to change the amount of space between each cell. This is achieved through the use of cellspacing attribute. For example: &lt;table cellspacing=&#8221;15&#8243; &gt; this tag apply 15 pixel of space between each cell. The HTML code given below demonstrates the use of cellspacing&nbsp;is given below:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"html\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;html>\n  &lt;head>\n    &lt;title>Table Tag with Cellspacing&lt;\/title>\n  &lt;\/head>\n  &lt;body>\n    &lt;p>This is the demonstration of displaying Tables with cellspacing attribute&lt;\/p>\n    &lt;table border=\"1\" width=\"60%\" cellspacing=\"15\">\n      &lt;tr>\n        &lt;td>S.No&lt;\/td>\n        &lt;td>Name&lt;\/td>\n        &lt;td>Amount&lt;\/td>\n      &lt;\/tr>\n      &lt;tr>\n        &lt;td>101&lt;\/td>\n        &lt;td>aaa&lt;\/td>\n        &lt;td>12,256&lt;\/td>\n      &lt;\/tr>\n      &lt;tr>\n        &lt;td>102&lt;\/td>\n        &lt;td>bbb&lt;\/td>\n        &lt;td>8,256&lt;\/td>\n      &lt;\/tr>\n      &lt;tr>\n        &lt;td>103&lt;\/td>\n        &lt;td>ccc&lt;\/td>\n        &lt;td>24,525&lt;\/td>\n      &lt;\/tr>\n    &lt;\/table>\n  &lt;\/body>\n&lt;\/html><\/pre>\n\n\n\n<p>The output of the above HTML code for demonstrating cellspacing is shown below:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"http:\/\/softlect.in\/wp-content\/uploads\/HTMLIntroduction\/34.-Table-Tag-with-Cellspacing-Output.png\"><img loading=\"lazy\" width=\"855\" height=\"531\" src=\"http:\/\/softlect.in\/wp-content\/uploads\/HTMLIntroduction\/34.-Table-Tag-with-Cellspacing-Output.png\" alt=\"\" class=\"wp-image-2561\" srcset=\"http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/34.-Table-Tag-with-Cellspacing-Output.png 855w, http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/34.-Table-Tag-with-Cellspacing-Output-300x186.png 300w, http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/34.-Table-Tag-with-Cellspacing-Output-768x477.png 768w\" sizes=\"(max-width: 855px) 100vw, 855px\" \/><\/a><\/figure><\/div>\n\n\n\n<p>In all the above example of creating tables, we have observed that the length of rows and columns are same. In some situations, the length of rows and columns may be different. The &lt;td&gt; tag allows additional attributes for spanning rows and columns.<\/p>\n\n\n\n<h2>Spanning Columns<\/h2>\n\n\n\n<p>The &lt;td&gt; tag allows colspan attribute to span number of columns. For example &lt;td colspn=&#8221;3&#8243;&gt; means the content of the cell for the above tag will span 3 columns. Let us consider the table given below:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"http:\/\/softlect.in\/wp-content\/uploads\/HTMLIntroduction\/HTML-Image-Table-Colspan.png\"><img loading=\"lazy\" width=\"1148\" height=\"409\" src=\"http:\/\/softlect.in\/wp-content\/uploads\/HTMLIntroduction\/HTML-Image-Table-Colspan.png\" alt=\"\" class=\"wp-image-2491\" srcset=\"http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/HTML-Image-Table-Colspan.png 1148w, http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/HTML-Image-Table-Colspan-300x107.png 300w, http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/HTML-Image-Table-Colspan-768x274.png 768w, http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/HTML-Image-Table-Colspan-1024x365.png 1024w\" sizes=\"(max-width: 1148px) 100vw, 1148px\" \/><\/a><\/figure><\/div>\n\n\n\n<p>The HTML code given below&nbsp;creates a table where the first row contains only one cell which can be seen in&nbsp;line 9 where there is only one &lt;td&gt; tag.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"html\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;html>\n  &lt;head>\n    &lt;title>Table Tag without Colspan&lt;\/title>\n  &lt;\/head>\n  &lt;body>\n    &lt;p>This is the demonstration of displaying Tables without Colspan&lt;\/p>\n    &lt;table border=\"1\" width=\"60%\">\n      &lt;tr>\n        &lt;td>Data&lt;\/td>\n      &lt;\/tr>\n      &lt;tr>\n        &lt;td>101&lt;\/td>\n        &lt;td>aaa&lt;\/td>\n        &lt;td>12,256&lt;\/td>\n      &lt;\/tr>\n      &lt;tr>\n        &lt;td>102&lt;\/td>\n        &lt;td>bbb&lt;\/td>\n        &lt;td>8,256&lt;\/td>\n      &lt;\/tr>\n      &lt;tr>\n        &lt;td>103&lt;\/td>\n        &lt;td>ccc&lt;\/td>\n        &lt;td>24,525&lt;\/td>\n      &lt;\/tr>\n    &lt;\/table>\n  &lt;\/body>\n&lt;\/html><\/pre>\n\n\n\n<p>The output of the above HTML code is shown below where the first row contains only one cell with the &#8220;Data&#8221; as content and rest of the cell are not present. The output shown below is not according to the desired result.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"http:\/\/softlect.in\/wp-content\/uploads\/HTMLIntroduction\/35.-Table-Tag-without-Colspan-Output.png\"><img loading=\"lazy\" width=\"855\" height=\"531\" src=\"http:\/\/softlect.in\/wp-content\/uploads\/HTMLIntroduction\/35.-Table-Tag-without-Colspan-Output.png\" alt=\"\" class=\"wp-image-2565\" srcset=\"http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/35.-Table-Tag-without-Colspan-Output.png 855w, http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/35.-Table-Tag-without-Colspan-Output-300x186.png 300w, http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/35.-Table-Tag-without-Colspan-Output-768x477.png 768w\" sizes=\"(max-width: 855px) 100vw, 855px\" \/><\/a><\/figure><\/div>\n\n\n\n<p>The above code can be modified by using colspan attribute in &lt;td&gt; tag as seen in line 9 of the code given below. The colspan attribute uses &#8220;3&#8221; as the value to span &#8220;3&#8221; colomns.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"html\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;html>\n  &lt;head>\n    &lt;title>Table Tag with Colspan&lt;\/title>\n  &lt;\/head>\n  &lt;body>\n    &lt;p>This is the demonstration of displaying Tables with Colspan&lt;\/p>\n    &lt;table border=\"1\" width=\"60%\">\n      &lt;tr>\n        &lt;td colspan=\"3\">Data&lt;\/td>\n      &lt;\/tr>\n      &lt;tr>\n        &lt;td>101&lt;\/td>\n        &lt;td>aaa&lt;\/td>\n        &lt;td>12,256&lt;\/td>\n      &lt;\/tr>\n      &lt;tr>\n        &lt;td>102&lt;\/td>\n        &lt;td>bbb&lt;\/td>\n        &lt;td>8,256&lt;\/td>\n      &lt;\/tr>\n      &lt;tr>\n        &lt;td>103&lt;\/td>\n        &lt;td>ccc&lt;\/td>\n        &lt;td>24,525&lt;\/td>\n      &lt;\/tr>\n    &lt;\/table>\n  &lt;\/body>\n&lt;\/html><\/pre>\n\n\n\n<p>The output of the above code with colspan attribute is shown below:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"http:\/\/softlect.in\/wp-content\/uploads\/HTMLIntroduction\/35.-Table-Tag-with-Colspan-Output.png\"><img loading=\"lazy\" width=\"855\" height=\"531\" src=\"http:\/\/softlect.in\/wp-content\/uploads\/HTMLIntroduction\/35.-Table-Tag-with-Colspan-Output.png\" alt=\"\" class=\"wp-image-2563\" srcset=\"http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/35.-Table-Tag-with-Colspan-Output.png 855w, http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/35.-Table-Tag-with-Colspan-Output-300x186.png 300w, http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/35.-Table-Tag-with-Colspan-Output-768x477.png 768w\" sizes=\"(max-width: 855px) 100vw, 855px\" \/><\/a><\/figure><\/div>\n\n\n\n<h2>Spanning Rows<\/h2>\n\n\n\n<p>The &lt;td&gt; tag allows rowspan attribute to span number of rows. For example &lt;td rowspan=&#8221;2&#8243;&gt; means the content of the cell for the tag will span 2 rows.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"http:\/\/softlect.in\/wp-content\/uploads\/HTMLIntroduction\/HTML-Image-Table-Rowpan.png\"><img loading=\"lazy\" width=\"1147\" height=\"309\" src=\"http:\/\/softlect.in\/wp-content\/uploads\/HTMLIntroduction\/HTML-Image-Table-Rowpan.png\" alt=\"Table Rowspan\" class=\"wp-image-2493\" srcset=\"http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/HTML-Image-Table-Rowpan.png 1147w, http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/HTML-Image-Table-Rowpan-300x81.png 300w, http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/HTML-Image-Table-Rowpan-768x207.png 768w, http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/HTML-Image-Table-Rowpan-1024x276.png 1024w\" sizes=\"(max-width: 1147px) 100vw, 1147px\" \/><\/a><figcaption><strong>Table Rowspan<\/strong><\/figcaption><\/figure><\/div>\n\n\n\n<p>The HTML code given below is written without using the rowspan attribute for the &lt;td&gt; tag and the rows and cells are created accordingly.<\/p>\n\n\n<p>[html]<br \/>\n&lt;html&gt;<br \/>\n&lt;head&gt;<br \/>\n&lt;title&gt;Table Tag without Rowspan&lt;\/title&gt;<br \/>\n&lt;\/head&gt;<br \/>\n&lt;body&gt;<br \/>\n&lt;p&gt;This is the demonstration of displaying Tables without Rowspan&lt;\/p&gt;<br \/>\n&lt;table border=&#8221;1&#8243; width=&#8221;60%&#8221;&gt;<br \/>\n&lt;tr&gt;<br \/>\n&lt;td&gt;101&lt;\/td&gt;<br \/>\n&lt;td&gt;aaa&lt;\/td&gt;<br \/>\n&lt;td&gt;12,256&lt;\/td&gt;<br \/>\n&lt;\/tr&gt;<br \/>\n&lt;tr&gt;<br \/>\n&lt;td&gt;bbb&lt;\/td&gt;<br \/>\n&lt;td&gt;8,256&lt;\/td&gt;<br \/>\n&lt;\/tr&gt;<br \/>\n&lt;tr&gt;<br \/>\n&lt;td&gt;ccc&lt;\/td&gt;<br \/>\n&lt;td&gt;24,525&lt;\/td&gt;<br \/>\n&lt;\/tr&gt;<br \/>\n&lt;\/table&gt;<br \/>\n&lt;\/body&gt;<br \/>\n&lt;\/html&gt;<br \/>\n[\/html]<\/p>\n\n\n\n<p>The output of the above HTML code is shown below where the first row contains three columns but in the rest of the rows data is not according to the desired result.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"http:\/\/softlect.in\/wp-content\/uploads\/HTMLIntroduction\/36.-Table-Tag-without-Rowspan-Output.png\"><img loading=\"lazy\" width=\"855\" height=\"531\" src=\"http:\/\/softlect.in\/wp-content\/uploads\/HTMLIntroduction\/36.-Table-Tag-without-Rowspan-Output.png\" alt=\"\" class=\"wp-image-2569\" srcset=\"http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/36.-Table-Tag-without-Rowspan-Output.png 855w, http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/36.-Table-Tag-without-Rowspan-Output-300x186.png 300w, http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/36.-Table-Tag-without-Rowspan-Output-768x477.png 768w\" sizes=\"(max-width: 855px) 100vw, 855px\" \/><\/a><\/figure><\/div>\n\n\n\n<p>The above code can be modified by using rowspan attribute in &lt;td&gt; tag as seen in line 9 of the code given below. The rowspan attribute uses &#8220;3&#8221; as the value to span &#8220;3&#8221; rows.<\/p>\n\n\n<p>[html]<br \/>\n&lt;html&gt;<br \/>\n&lt;head&gt;<br \/>\n&lt;title&gt;Table Tag with Rowspan&lt;\/title&gt;<br \/>\n&lt;\/head&gt;<br \/>\n&lt;body&gt;<br \/>\n&lt;p&gt;This is the demonstration of displaying Tables with Rowspan&lt;\/p&gt;<br \/>\n&lt;table border=&#8221;1&#8243; width=&#8221;60%&#8221;&gt;<br \/>\n&lt;tr&gt;<br \/>\n&lt;td rowspan=&#8221;3&#8243;&gt;101&lt;\/td&gt;<br \/>\n&lt;td&gt;aaa&lt;\/td&gt;<br \/>\n&lt;td&gt;12,256&lt;\/td&gt;<br \/>\n&lt;\/tr&gt;<br \/>\n&lt;tr&gt;<br \/>\n&lt;td&gt;bbb&lt;\/td&gt;<br \/>\n&lt;td&gt;8,256&lt;\/td&gt;<br \/>\n&lt;\/tr&gt;<br \/>\n&lt;tr&gt;<br \/>\n&lt;td&gt;ccc&lt;\/td&gt;<br \/>\n&lt;td&gt;24,525&lt;\/td&gt;<br \/>\n&lt;\/tr&gt;<br \/>\n&lt;\/table&gt;<br \/>\n&lt;\/body&gt;<br \/>\n&lt;\/html&gt;<br \/>\n[\/html]<\/p>\n\n\n\n<p>The output of the above code with rowspan attribute is shown below:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"http:\/\/softlect.in\/wp-content\/uploads\/HTMLIntroduction\/36.-Table-Tag-with-Rowspan-Output.png\"><img loading=\"lazy\" width=\"855\" height=\"531\" src=\"http:\/\/softlect.in\/wp-content\/uploads\/HTMLIntroduction\/36.-Table-Tag-with-Rowspan-Output.png\" alt=\"\" class=\"wp-image-2567\" srcset=\"http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/36.-Table-Tag-with-Rowspan-Output.png 855w, http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/36.-Table-Tag-with-Rowspan-Output-300x186.png 300w, http:\/\/softlect.com\/wp-content\/uploads\/HTMLIntroduction\/36.-Table-Tag-with-Rowspan-Output-768x477.png 768w\" sizes=\"(max-width: 855px) 100vw, 855px\" \/><\/a><\/figure><\/div>\n\n\n\n<p>Note that the value for both the attributes; colspan and rowspan&nbsp;must contain a numerical value.<\/p>\n\n\n\n<h2>Additional Formatting for Tables<\/h2>\n\n\n\n<p>The table tag contains additional tags in its container, such as &lt;thead&gt;, &lt;tbody&gt; and &lt;tfoot&gt;. The benefit of using these additional table tags is that for long tables, header information is repeated in each page when the table is printed.&nbsp; Though using these tags will not have any effect on the display of the table content on the web browser. The code to demonstrate the use of &lt;thead&gt;, &lt;tbody&gt; and &lt;tfoot&gt; is given below:<\/p>\n\n\n<p>[html]<br \/>\n&lt;html&gt;<br \/>\n&lt;head&gt;<br \/>\n&lt;title&gt;Table Tag with Additional Tags&lt;\/title&gt;<br \/>\n&lt;\/head&gt;<br \/>\n&lt;body&gt;<br \/>\n&lt;p&gt;This is the demonstration of displaying Tables with additional attributes&lt;\/p&gt;<br \/>\n&lt;table border=&#8221;1&#8243; width=&#8221;60%&#8221;&gt;<br \/>\n&lt;thead&gt;<br \/>\n&lt;tr&gt;<br \/>\n&lt;th&gt;S.No&lt;\/th&gt;<br \/>\n&lt;th&gt;Name&lt;\/th&gt;<br \/>\n&lt;th&gt;Amount&lt;\/th&gt;<br \/>\n&lt;\/tr&gt;<br \/>\n&lt;\/thead&gt;<br \/>\n&lt;tbody&gt;<br \/>\n&lt;tr&gt;<br \/>\n&lt;td&gt;101&lt;\/td&gt; &lt;td&gt;aaa&lt;\/td&gt; &lt;td&gt;12,256&lt;\/td&gt;<br \/>\n&lt;\/tr&gt;<br \/>\n&lt;tr&gt;<br \/>\n&lt;td&gt;102&lt;\/td&gt; &lt;td&gt;bbb&lt;\/td&gt; &lt;td&gt;8,256&lt;\/td&gt;<br \/>\n&lt;\/tr&gt;<br \/>\n&lt;\/tbody&gt;<br \/>\n&lt;tfoot&gt;<br \/>\n&lt;tr&gt;<br \/>\n&lt;th&gt;S.No&lt;\/th&gt;<br \/>\n&lt;th&gt;Name&lt;\/th&gt;<br \/>\n&lt;th&gt;Amount&lt;\/th&gt;<br \/>\n&lt;\/tr&gt;<br \/>\n&lt;\/tfoot&gt;<br \/>\n&lt;\/table&gt;<br \/>\n&lt;\/body&gt;<br \/>\n&lt;\/html&gt;<br \/>\n[\/html]<\/p>\n\n\n\n<p>The output of the above HTML code will be the same as seen earlier.<\/p>\n\n\n\n<p>In conclusion, we have seen here the basics of writing HTML code with several tags for presenting text content, tags for displaying images, creating hyperlinks, various types of lists and creating tables. In the next post in this category, we will be learning how to create forms in HTML.<\/p>\n<\/div><\/div>\n\n\n\n<figure class=\"wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"HTML Step by Step for Beginners - Tables Tags\" width=\"1110\" height=\"624\" src=\"https:\/\/www.youtube.com\/embed\/0yVBxnHs2OY?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe>\n<\/div><figcaption>HTML Table Tags<\/figcaption><\/figure>\n\n\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Tags for Tables Tables can be created in HTML using &lt;table&gt; tag. In HTML table is a section of information broken into columns and rows of blocks called cells. The&hellip; <\/p>\n","protected":false},"author":1,"featured_media":2868,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[72],"tags":[],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"http:\/\/softlect.com\/index.php\/wp-json\/wp\/v2\/posts\/2818"}],"collection":[{"href":"http:\/\/softlect.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/softlect.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/softlect.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/softlect.com\/index.php\/wp-json\/wp\/v2\/comments?post=2818"}],"version-history":[{"count":66,"href":"http:\/\/softlect.com\/index.php\/wp-json\/wp\/v2\/posts\/2818\/revisions"}],"predecessor-version":[{"id":3744,"href":"http:\/\/softlect.com\/index.php\/wp-json\/wp\/v2\/posts\/2818\/revisions\/3744"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/softlect.com\/index.php\/wp-json\/wp\/v2\/media\/2868"}],"wp:attachment":[{"href":"http:\/\/softlect.com\/index.php\/wp-json\/wp\/v2\/media?parent=2818"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/softlect.com\/index.php\/wp-json\/wp\/v2\/categories?post=2818"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/softlect.com\/index.php\/wp-json\/wp\/v2\/tags?post=2818"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}