Showing posts with label html table Alignment with example. Show all posts
Showing posts with label html table Alignment with example. Show all posts

Wednesday, October 5, 2022

HTML Table Attribute in html

 

     Table Tag

                                       Attributes 


Html table tag



1) Rowspan Tag 

The rowspan attribute in HTML specifies the number of rows a cell should span. That is if a row spans two rows, it means it will take up the space of two rows in that table. It allows the single table cell to span the height of more than one cell or row.


Example

program 

<html>

<body>

<h1>Example of TD Rowspan attribute</h1> <table border="1">

<tr>
<th>Student</th>
<th>Fees Amount</th>
<th>Course</th>
</tr>
<tr>
<td>Manish</td>
<td>700</td>
<td rowspan="2">Java</td>
</tr> <tr>
<td>Puneet</td> <td>800</td>
</tr>
</table>

</body>

</html>

 

Rowspan Tag output

TD Rowspan attribute

2] HTML <td> Colspan Attribute.


Question :-


1] What is the colspan tag in HTML ?
2] What is colspan and rowspan ? 

Information :-

The colspan attribute in HTML specifies the number of columns a cell should span. It allows the single table cell to span the width of more than one cell or column. It provides the same functionality as merge cell in a spreadsheet program like Excel.

 

Example

<html>
<body>
<h1>Example of TD colspan attribute</h1> <table border="1">
<tr> <th colspan="2">Student Fees detail</th></tr>
<tr>
<th>Student</th>
<th>Fees Amount</th>
</tr>
<tr>
<td>Manish</td>
<td>1000</td>
</tr>
<tr>
<td>Puneet</td>
<td>2000</td>
</tr>
<tr> <td colspan="2">Total: 3000</td>
</tr>
</table>
</body>
</html>


Colspan Tag output

TD colspan Attribute

3)  Alignment Tag 

The HTML <td> valign Attribute is used to specify the vertical alignment of text content in a cell. Attribute Value top - It sets the content to top-align. middle -It sets the content to middle-align. Bottom - It sets the content to bottom-align.

1) Example

<! Doctype html>

<html>
<body>
<table  height="300" width="500" Border="2" Bordercolor="red"> 

<caption> Use of Verticle Alignment Attribute of Table</caption> 
<tr>

<td valign="Top">Top Align content</td>
<td valign="Center">Center Align content
</td>
 <td valign="Bottom">Bottom Align content</td> 
</tr>
</table>
</body>
</html>

 Alignment  OUTPUT


Verticle Alignment Tag



2) Example

<! Doctype html>
<html>
<body>
<table bgcolor="yellow" height="300" width="500" Border="2" Bordercolor="red"> 

<caption> Use of Verticle Alignment Attribute of Table</caption> 
<tr>

<td valign="Top">Top Align content
</td>


<td valign="Center">Center Align content
</td>

 <td valign="Bottom">Bottom Align content
</td> 

</tr>
</table>
</body>
</html

Question :- 

1]  How to align text in top HTML?
2] How to align text in center HTML?
3] How to align text in Bottom HTML?


Alignment OUTPUT




Verticle Alignment Tag




Related Post


html table program
css border bottom property
html tag Attributes
html Tag attributes
meta attribute html