Skip to main content

Use Of Colspan and Rowspan in Tables HTML

Colspan and Rowspan are two important attributes of TD and TH tags used in HTML tables.

Colspan




Colspan is an attribute of TD or TH tags used to make data cells and header cells in an HTML table. We can use Colspan to expand / span a cell on many columns. For example, in the following table, the first header cell spans two columns, so here we use <th colspan="2">Marks</th> to get the required result in the displayed html table.

Marks
MathsComputer
10087
The complete HTML coding is as follows:

<table border="1">
<tr> <th colspan="2">Marks</th> </tr>
<tr> <th>Maths</th><th>Computer</th></tr>
<tr> <td>100</td><td>87</td> </tr>
</table>

Rowspan

Rowspan attribute is used to expand or span a cell to multiple rows. For example, in the following table example, the first TH cell (Marks) spans on two rows. We use <th rowspan="2">Marks</th> for this purpose.


Marks
MathsComputer
10087

The complete HTML coding of the table is as follows:
<table border="1">
<tr> <th rowspan="2">Marks</th>
<th>Maths</th><th>Computer</th></tr>
<tr><td>100</td><td>87</td></tr>
</table> 

Comments

Popular posts from this blog

Explain different types of storage devices

Topic: Explain different types of storage devices in Computer systems Storage Devices Storage devices are used to store data and instructions permanently. Storage devices are also called secondary storage devices / backing storage devices / external storage devices or auxiliary storage devices. Examples of storage devices include Hard Disk, CD and DVD etc. Why Secondary Storage Devices are Used? Secondary storage devices are used because: Primary memory(RAM) is volatile and temporary. When computer is switched off, all data in ram is erased. Storage devices can store large amounts of data and instructions permanently whereas Primary memory has less capacity of storing data. Types Of Storage Devices There are three main types of storage devices:  Magnetic Tape   Magnetic Disk   Optical Disk   Flash Memory storage devices 1. Magnetic Tape Magnetic tape is the oldest storage device. It is made of plastic coated with magnetic material. Data is stored on mag

What are uses of computer at Home

Uses of Computer Today, computer is used in almost every field of life. The use of computer has made different tasks very easy for us. Computer can be used at home in the many different ways. Explain different uses of computers at Home Computer has made a very vital impact on our society. People are using computers for performing different tasks quickly and easily. In fact, computer has made our life more comfortable.   Uses of Computer at Home Computer can be used at home in the following ways: 1.  Home Budget Computer can be used to manage the home budget. What are the Uses of computer at home You can easily calculate your expenses and income with the help of a software like Microsoft Excel. In MS Excel you can prepare a simple worksheet to calculate your daily expenses and income. 2. Computer Games An important use of computer at home is playing games. Different types of games are available. And if you have internet connection, then you can play games online

Find Your Correct Age From Date of Birth

First of all click on First two digits to type Month number from keyboard like any number from 1 to 12. . Now click on next two digits and type day number of month that is date from 1 to 31. In the last step type the year of your birth in four digits like 1995.  Now click on the blue button with text "Calculate Age". Your accurate age will be displayed below the button. For example. If today is 09-16-2023 that is September 16, 2023 and you type birth date as 11-01-2000 that is November 1, 2000, your accurate age will be displayed as:Your age is 22 years, 10 months, and 15 days. Age Calculator Age Calculator Calculate Your Age Now! Enter your date of birth: Calculate Age As shown in the image below: