Wednesday, October 16, 2013

[html school] how to create a table

How to create a table



HTML tables in one page can be used for various purposes. Primarily used for tabulation of data, but also for the deployment of elements in page. The table represent a useful design tool for creating layout elements. Tables consisting of columns and rows where we can put our data or content. Content can be text,images, multimedia, hyperlinks, etc.. HTML tables are created with labels for rows and columns that are placed within the start tag and the end tag:
<table>
………
</table>


How to create a tableAfter mentioned labels, it is necessary to set the rows in the table. HTML row table is marked with the following elements:

<tr> ......... </ tr>

Each row of the HTML table containing a series of horizontal table cells with data, which contain the actual data. Cells are labeled with the following elements:


<td> ......... </ td>

Thus, the hierarchy of elements starting with element <table> ......... </ table> that contains all the other elements of the table. Element for table rows (<tr> ......... </ tr>) contains cells with the data from the table. Cells with data from a table (<td> ......... </ td>) contains the actual information to be displayed in the table. For creating Table 1, which consists of 2 rows and 3 columns, we write the following HTML code:
<table border=”1”>
<tr>
<td>Name</td>
<td>Last name</td>
<td>Nickname</td>
</tr>
<tr>
<td>Harry</td>
<td>Potter</td>
<td>Wizard</td>
</tr>
</table>

Inside the opening tag <table> can stand border attribute that is used to adjust the width of the edge of the table. Border attribute value is specified in pixels, as follows: <table border="1"> When a table is used along with other content like images which explains something, it is often necessary to create a table title. Using elements <caption> ... </ caption> table be added the title or caption. When used, the element <caption> must be the first element in the element <table>. Otherwise, the label table is not displayed. This element has a predefined format, and a special appearance must be defined. An example that illustrates the above, is given below:

<table border=”1”>
<caption>Caption for table</caption>
<tr>
<td>Name</td>
<td>Last name</td>
<td>Nickname</td>
</tr>
<tr>
<td>Harry</td>
<td>Potter</td>
<td>Wizard</td>
</tr>
</table>

0 comments:

Post a Comment

 

Every monday and friday new html lesson on Computershole

X