web design - working with tables in html

10
Fundamentals of Web designing Ministry of Higher Education Bamyan University Computer Science Department 1 Presented by : Mustafa Kamel Mohammadi Email : [email protected] Working tables in HTML

Upload: mustafa-kamel-mohammadi

Post on 15-Jan-2017

24 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Web design - Working with tables in HTML

1

Fundamentals of Web designing

Ministry of Higher EducationBamyan University

Computer Science Department

Presented by : Mustafa Kamel MohammadiEmail : [email protected]

Working tables in HTML

Page 2: Web design - Working with tables in HTML

2

learning objective In this chapter you will learn

How to create tables in HTML

Page 3: Web design - Working with tables in HTML

3

Tables in HTML Table is a structured element that consists of rows and columns of cells The <table> and </table>tags define where the table begins and ends The <tr>and </tr> tags define where each row begins and ends The <td>and </td>tags define the individual cells within each row.

<table><tr>

<td> 1 </td><td> 2 </td><td> 3 </td>

</tr>

</table>

Page 4: Web design - Working with tables in HTML

4

Table borders and cell spacing, padding To add border around table you can use “border” attribute To control spaces between cells in a table, use “cellspacing” attribute To control space between cell and its internal content use “cellpadding”

<table border=”2” cellspacing=”10” cellpadding=”10” bordercolor=”#FF0000”>

</table>

Page 5: Web design - Working with tables in HTML

5

Spanning columns an rows To span a cell across columns use “Colspan” attribute in <td> tags

It take a numeric value, the value indicates the number of columns To span a cell across columns use “rowspan” attribute in <td> tags

It take a numeric value, the value indicates the number of rows

<td colspan=”3”> 1 </td><td rowspan=”3”> 1 </td>

Page 6: Web design - Working with tables in HTML

6

Table alignment and dimension To align table in respect to texts around it, set “align” attribute for <table> tag to

(left, right, center) To align content of cell set “align” attribute for <td> tag. We can also set width and height for tables using “width” and “height” attr.

<table align=“left” width=“800” height=“400” >

</table>

Page 7: Web design - Working with tables in HTML

7

Background color of table Use “bgcolor” attribute to set background color for <td>, <tr>,<table>

<table bagcolor=“cyan”><tr bgcolor=“red”>

<td bfcolor=“blue”></td></tr>

</table>

Page 8: Web design - Working with tables in HTML

8

Logical structure of table<table>

<thead><tr><th></th></tr></thead><tbody><tr><td></td><td></td></tr></tbody>

<foot><tr><td colspan=2></td></tr></tfoot>

</table>

Page 9: Web design - Working with tables in HTML

9

Page 10: Web design - Working with tables in HTML

10

References• “HTML 4 dummies 5th edition” by Ed Tittel & Mary Burmeister• “HTML 5 designing rich internet applications” by Mathew Dawid• “HTML in ten simple steps” by Robert G. fuller