HTML Introduction

HTML Basic Syntax

HTML Block Element

HTML Formatting

HTML Quotation

HTML Links

HTML List

HTML Table

HTML Audio

HTML Video

HTML Image

HTML Iframe

HTML Favicon

HTML Form

HTML Input Types

HTML Marquee

HTML Meta tag

Learn CSS

Learn Javascript

Learn Django

Everything about HTML table

How to create table?

For creating table, <table> tag is used. For creating columns and column names of the table, <th> tag is used. For creating row of the table, <tr> tag is used. For creating cell of a table row, <td> tag is used inside <tr> tag.

<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>

<table>
<th>Column1</th>
<th>Column2</th>

<tr><td>1</td><td>2</td></tr>
<tr><td>6</td><td>5</td></tr>

</table>

</body>
</html>

Some table attributes:

1. border: it is used to give border of the table.
2. align: it is used for align the text of the table.
3. width: it is used to set the width of cells of the table.
4. height: it is used to set the height of cells of the table.
5. bgcolor: it is used to give background color of the table.
6. cellpadding: it is used to give padding between cell of the table.
7. cellspacing: it is used to give space between cells of the table.
8. rowspan:Suppose we want to convert two row cells into one cell or 5 or more cells into one cell. To do this, we use this attribute. To convert 5 row cells into one cell pass 5 as the rowspan attribute value.
9. colspan:Suppose we want to convert two or more column cells into one cell. In that case, we use this attribute. To convert 5 column cell into one cell pass 5 as the colspan attribute value.

<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>

<table border=1 align="center" width="5%" bgcolor:"gray" cellpadding="3" cellspacing="5">
<th>Column1</th>
<th>Column2</th>

<tr><td>1</td><td rowspan=2>2</td></tr>
<tr><td>6</td><td>5</td></tr>

</table>

</body>
</html>

CodersAim is created for learning and training a self learner to become a professional from beginner. While using CodersAim, you agree to have read and accepted our terms of use, privacy policy, Contact Us

© Copyright All rights reserved www.CodersAim.com. Developed by CodersAim.