<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ankit Virparia &#187; html tag</title>
	<atom:link href="http://ankit.co/tag/html-tag/feed" rel="self" type="application/rss+xml" />
	<link>http://ankit.co</link>
	<description>A Programmer, Designer and Trainer</description>
	<lastBuildDate>Sun, 11 May 2014 04:15:47 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.0.38</generator>
	<item>
		<title>HTML table tag</title>
		<link>http://ankit.co/tutorials/html/html-table-tag?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=html-table-tag</link>
		<comments>http://ankit.co/tutorials/html/html-table-tag#comments</comments>
		<pubDate>Tue, 14 May 2013 05:56:02 +0000</pubDate>
		<dc:creator><![CDATA[Ankit Virparia]]></dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[html tag]]></category>
		<category><![CDATA[table]]></category>

		<guid isPermaLink="false">http://ankit.co/?p=3402</guid>
		<description><![CDATA[<p>What is a table? Table is a structure which is used to store two dimensional information (eg. Excel) It is a combination of rows and columns. Characteristics of tabular data Width of all columns will be same. Height of all rows will be same. Number of columns in each row should be same. When we [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://ankit.co/tutorials/html/html-table-tag">HTML table tag</a> appeared first on <a rel="nofollow" href="http://ankit.co">Ankit Virparia</a>.</p>
]]></description>
				<content:encoded><![CDATA[<h2>What is a table?</h2>
<ul>
<li>Table  is a structure which is used to store two dimensional information (eg. Excel)</li>
<li>It  is a combination of rows and columns.</li>
</ul>
<h3>Characteristics  of tabular data</h3>
<ul>
<li>Width  of all columns will be same.</li>
<li>Height  of all rows will be same.</li>
<li>Number  of columns in each row should be same.</li>
<li>When  we store any tabular information, generally the first row represents name of  the column.</li>
</ul>
<h2>HTML table tag</h2>
<ul>
<li>For  creating a table in html mainly four tags are used. The tags are as follows:</li>
<li>&lt;table&gt;  &#8211; used to define the structure of the table</li>
<li>&lt;th&gt;  &#8211; used to define the header of the table.</li>
<li>&lt;tr&gt;  &#8211; used to define a row of the table.</li>
<li>&lt;td&gt;  &#8211; used to define individual cells of the table.</li>
<li>Suppose  we want to create a table of size 2&#215;2 i.e. to create a table having 2 rows and  two columns.</li>
</ul>
<pre class="brush: xml; title: ; notranslate">
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Welcome&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;table&gt;
&lt;tr&gt;
&lt;td&gt; 1 &lt;/td&gt;
&lt;td&gt; 2 &lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; 3 &lt;/td&gt;
&lt;td&gt; 4 &lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/body&gt;
&lt;/html&gt;  
</pre>
<p><b>Output:</b></p>
<table>
<tr>
<td> 1 </td>
<td> 2 </td>
</tr>
<tr>
<td> 3 </td>
<td> 4 </td>
</tr>
</table>
<p><b>Note:</b> When we create a table,  by default it will have following characteristics:</p>
<ul>
<li>no  border</li>
<li>aligned  left</li>
<li>occupy  width and height which is required to accommodate the text.</li>
</ul>
<p>If we want to set these  values, we need to use three attributes of &lt;table&gt; tag.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Welcome&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;table border=&quot;1px&quot; align=&quot;center&quot; width=&quot;300px&quot; height=&quot;300px&quot;&gt;
&lt;tr&gt;
&lt;td&gt; 1 &lt;/td&gt;
&lt;td&gt; 2 &lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; 3 &lt;/td&gt;
&lt;td&gt; 4 &lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p><b>Output:</b></p>
<table border="1px" align="center" width="300px" height="300px">
<tr>
<td> 1 </td>
<td> 2 </td>
</tr>
<tr>
<td> 3 </td>
<td> 4 </td>
</tr>
</table>
<ul>
<li> <strong>Merging of cells</strong>
<ul>
<li>Many times it is required to merge columns or merge rows together. To achieve this  we have to attributes : rowspan and colspan.</li>
<li>Rowspan  : this attribute is used to merge rows together into one row. If we want to  merge three rows then we need to assign the value 3 to this attribute.</li>
<li>Colspan  : this attribute is used to merge columns together. If we want to merge two  columns then we need to assign the value 2 to this attribute.</li>
</ul>
</li>
</ul>
<h3>Examples:</h3>
<p><strong>Table  &#8211; 1</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;table border=&quot;1px&quot; align=&quot;center&quot; width=&quot;300px&quot; height=&quot;200px&quot;&gt;
&lt;tr&gt;
&lt;td colspan=&quot;2&quot;&gt; 1 &lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; 2&lt;/td&gt;
&lt;td&gt; 3&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
</pre>
<p><b>Output:</b></p>
<table border="1px" align="center" width="300px" height="200px">
<tr>
<td colspan="2"> 1 </td>
</tr>
<tr>
<td> 2</td>
<td> 3</td>
</tr>
</table>
<p><strong>Table  &#8211; 2</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;table border=&quot;1px&quot; align=&quot;center&quot; width=&quot;300px&quot; height=&quot;200px&quot;&gt;
&lt;tr&gt;
&lt;td &gt;1 &lt;/td&gt;
&lt;td&gt; 2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td colspan=&quot;2&quot;&gt; 3 &lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
</pre>
<p><b>Output:</b></p>
<table border="1px" align="center" width="300px" height="200px">
<tr>
<td >1 </td>
<td> 2</td>
</tr>
<tr>
<td colspan="2"> 3 </td>
</tr>
</table>
<p><strong>Table  &#8211; 3</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;table border=&quot;1px&quot; align=&quot;center&quot; width=&quot;300px&quot; height=&quot;200px&quot;&gt;
&lt;tr&gt;
&lt;td&gt; 1 &lt;/td&gt;
&lt;td rowspan=&quot;2&quot;&gt; 2 &lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; 3 &lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
</pre>
<p><b>Output:</b></p>
<table border="1px" align="center" width="300px" height="200px">
<tr>
<td> 1 </td>
<td rowspan="2"> 2 </td>
</tr>
<tr>
<td> 3 </td>
</tr>
</table>
<p><strong>Table  &#8211; 4</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;tabl eborder=&quot;1px&quot; align=&quot;center&quot; width=&quot;300px&quot; height=&quot;200px&quot;&gt;
&lt;tr&gt;
&lt;td rowspan=&quot;2&quot;&gt; 1 &lt;/td&gt;
&lt;td&gt; 2 &lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; 3 &lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
</pre>
<p><b>Output:</b></p>
<table border="1px" align="center" width="300px" height="200px">
<tr>
<td rowspan="2"> 1 </td>
<td> 2 </td>
</tr>
<tr>
<td> 3 </td>
</tr>
</table>
<p><br/></p>
<h3>Creating  table for storing records</h3>
<p>Generally when we store  any data in a table, each cell of first row describes the name of that  particular column. That data is considered to be table header and the tag used  for it is &lt;th&gt; tag.</p>
<ul>
<li>Characteristics  of &lt;th&gt; tag.</li>
<li>Text  written inside &lt;th&gt; tag is by default aligned to center.</li>
<li>Text  is displayed in bold letters.</li>
</ul>
<p><b>Sample  program: </b></p>
<pre class="brush: xml; title: ; notranslate">
&lt;table border=&quot;1px&quot; align=&quot;center&quot; width=&quot;400px&quot;&gt;
&lt;tr&gt;
&lt;th&gt; ID &lt;/th&gt;
&lt;th&gt; NAME &lt;/th&gt;
&lt;th&gt; CONTACT &lt;/th&gt;
&lt;th&gt; EMAIL &lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; 1 &lt;/td&gt;
&lt;td&gt; Ankit Virparia &lt;/td&gt;
&lt;td&gt; 9925720005 &lt;/td&gt;
&lt;td&gt; ankit@ankit.co &lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; 2 &lt;/td&gt;
&lt;td&gt; Sonali Virparia &lt;/td&gt;
&lt;td&gt; 9925720005&lt;/td&gt;
&lt;td&gt; sonali@ankit.co&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
</pre>
<p><b>Output:</b></p>
<table border="1px" align="center" width="400px">
<tr>
<th> ID </th>
<th> NAME </th>
<th> CONTACT </th>
<th> EMAIL </th>
</tr>
<tr>
<td> 1 </td>
<td> Ankit Virparia </td>
<td> 9925720005 </td>
<td> ankit@ankit.co </td>
</tr>
<tr>
<td> 2 </td>
<td> Sonali Virparia </td>
<td> 9925720005</td>
<td> sonali@ankit.co</td>
</tr>
</table>
<p>The post <a rel="nofollow" href="http://ankit.co/tutorials/html/html-table-tag">HTML table tag</a> appeared first on <a rel="nofollow" href="http://ankit.co">Ankit Virparia</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://ankit.co/tutorials/html/html-table-tag/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
