You are on page 1of 2

TABLES in HTML

Table is collection of data in rows and columns. <TABLE> Tag is used to create a table in html. Inside table tag
we use <TR> tag for creating each row and <TH> and <TD> tags are used to fill the data. <TH> stands for table
heading and it shows the text in bold letters and center aligned whereas <TD> Tag shows the data as plain text
in the cell.

Using rowspan and colspan attributes with td and th tag : When a single cell has to occupy more space, like
space covering multiple rows or multiple columns, rowspan or colspan attribute can be used respectively. When
a cell needs to cover multiple columns we use colspan, for eg in the following table the cell in first row is taking
space of three columns thus we write colspan=”3”.

AEC – ALCoders App, Youtube : Anjali Luthra Instagram : aec_computer_education pg. 1


Changing Background Colour of the table: We can change background colour of the table using bgcolor
attribute with table tag. We can even change the colour of individual row by using bgcolor attribute with <tr>
tag or a single cell also using bgcolor attribute with <td> or <th> tag.

AEC – ALCoders App, Youtube : Anjali Luthra Instagram : aec_computer_education pg. 2

You might also like