HOME | PHP Tutorial | CSS
facebook icon
HTML Tutorial

CSS Tutorial

HTML table

The HTML table allows to arrange all data on the page like, text, images, links, forms, etc. into rows and columns of cells.
The HTML tables are created using the <table> tag, <tr> tag is used to create table rows and <td> tag is used to create data cells. The elements under <td> are regular left aligned by default.

HTML table border, HTML table style, table width

An HTML table is defined with the <table> tag where we add style with: width, border color and more .
Example 1:
<table style="width:100%; border:#C30 thin solid; text-align:center">
Note: HTML image alt attribute. The value of the alt attribute from above example 1 should describe the image what it looks like.
The html cod above will display this HTML table result:
HTML table border, HTML table style, table width, text-align:center result.
Firstname LastnameAge
Jilly Ford55
Evea Sonjak48

HTML table Colspan and Rowspan Attributes

Yf you want to merge two or more columns into a single column you will use colspan attribute. If you want to merge two or more rows you will use rowspan.
<!DOCTYPE html>
<title>HTML Table Colspan/Rowspan</title>
<table border = "1">
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
<td rowspan = "2">Row 1 Cell 1</td>
<td>Row 1 Cell 2</td>
<td>Row 1 Cell 3</td>
<td>Row 2 Cell 2</td>
<td>Row 2 Cell 3</td>
<td colspan = "3">Row 3 Cell 1</td>

This HTML code will produce the following result −
Column 1 Column 2 Column 3
Row 1 Cell 1 Row 1 Cell 2 Row 1 Cell 3
Row 2 Cell 2 Row 2 Cell 3
Row 3 Cell 1

HTML Table Height and Width

You can specify table width and tabele height in pixels or percentage of available screen area.
Example 3:
<table border = "2" width = "450" height = "160">
<td>Row 1, Column 1</td>
<td>Row 1, Column 2</td>
<td>Row 2, Column 1</td>
<td>Row 2, Column 2</td>

This HTML code will produce the following result −
Row 1, Column 1 Row 1, Column 2
Row 2, Column 1 Row 2, Column 2

HTML table, border, width, style, center, color, colspan, tag, rowspan, example, tag, css HTML table style, HTML border, width and height - html tutorial

2203. HTML Tutorial - Drop-Down-Listen-Menü
Listen oder Dropdown-Listen in HTML wählen. Wie man eine einfache Auswahlliste mit dem select-Tag erstellt

3051. HTML Colors: How to add Color to your Web Page
Learn about HTML colors with this HTML tutorial.

2130. HTML Tutorial - Creating And Using Horizontal Rules
Learn how to create a simple Horizontal rule. Give more style to you web page

2224. HTML Tutorial - Tags

2671. Links : Link Within a Page - HTML Tutorial
HTML links - HTML tutorial

2666. Links : Link Targets - HTML Tutorial
HTML links - HTML tutorial

Your add here
How to get PHP errors to display?
How to prevent sql injection in php mysqli
How do I get PHP errors to display - PHP error_reporting()
mysql_query(): The mysql extension is deprecated and will be removed i
Function eregi_replace() is deprecated in php - How to fix
PHP delete an element from an array
Uncaught Error: Call to undefined function MYSQL_NUM_ROWS() in
Deprecated: mysql_connect() mysql extension is deprecated and will be
mysqli_fetch_array() expects parameter 1 to be mysqli_result boolean g
SQL IN Operator - example
SQL like syntax and example
SQL WHERE AND & OR multiple conditions
SQL create table primary key autoincrement
PHP mysqli_connect () Function
SQL COUNT(), AVG() and SUM() Functions
Display data from SQL database with MySQLi into php - html table
SQL mysql order by columns, by date, by asc, by desc, random with PHP
PHP mysqli_query() Function - mysqli query
SQL delete row - SQL delete table
SQL update - SQL update select
Insert into SQL - Insert into table SQL - Insert data in sql
Login in PHP - simple login script with PHP MYSQL