Showing posts with label cellpadding tag. Show all posts
Showing posts with label cellpadding tag. Show all posts

Thursday, September 29, 2022

html Table Attributes

         

 Table Attributes Tag html tag          

       Table Attributes




Table tag :- 

1) Border Tag


The HTML <table> border Attribute is used to specify the border of a table. It sets the border around the table cells. Attribute Values 1: It sets the border around the table cells.


This can be set around the table by specifying values like 0 for no border is showing around the table cells, whereas value 1 is set to display a border around the table cells.

Program 

<! Doctype html>

<html>

<body>

<table border = 1>

<tr>

<th>header 1</th>

<th>header 2</th>

</tr><tr>

<td>cell 1</td>

<td>cell 2<\td>

</tr><tr>

<td>cell 3</td>

<td>cell 4</td>

</tr></table>

</body></html>


Border output


Border tag output







2) Cellpadding Tag 


The HTML <table> cellpadding Attribute is used to specify the space between the cell content and cell wall. The cellpadding attribute is set in terms of pixels. Attribute Values. pixels. It holds the space between the cell content and cell wall in terms of pixels.

Cellpadding sets the amount of space between the contents of the call and the cell boundary or edge. The default is 1. Cellpadding is an attribute of an. Individual cell in a table, so each cell ina table can have .the its own Cellpadding value.

Syntax

      <table cellpadding ="pixels">

Cellpadding Tag

Program 

<! Doctype html>

<html><body>

<P>Table without Cellpadding </p>

<table border = 1>

<tr>

<th>month</th>

<th>saving</th>

</tr><tr>

<td>January</td>

<td>$100</td>

</tr></table>

</head>

</body>

</html>

Cellpadding Tag  output

Cellpadding tag output



3) Cellspacing Tag


The cellpadding attribute, which specifies the space between the cell wall and the cell content. cell spacing refers to the amount of space that is held between the cells in a table. It is specified with the cellspacing attribute in the table element. Values are specified in number of pixels. Increasing the cell spacing results in wider shaded borders between cells. 

The cell spacing attribute places space around each cell in the table. The Cellspacing attribute used to control the amount of space between cells of a table. or we can say that cell spacing refers ,to  how space is left between each cell well in a  table. 

Program 

<!Doctype html>

<html><body>

<p>table without Cellpadding</p>

<table border =1>

<tr>

<th>month</th>

<th>saving</th>

</tr><tr>

<td>January</td>

<td>$100</td>

</tr></table>

</body>

</html>


Cellspacing Tag  output


Cellspacing Tag output



4) width and height  tag 

 The width attribute specifies the width of a table or the width of a. table cell. The width can be set either as an absolute value in pixel or as in percentage (%) .if the width attribute is not set it  will taks up the space of longest single word in each cell.


Syntax :-

Table width in pixel : <table border =1 width= 100>

Table width in percentage (%) 

<table border = 1 width = 100%>

The above html code display two tables one is 100 pixels in width and other one 100% width. First table will remain 100 pixels in width in any changes in browser window state , while other tables will stretch the full  width of windows in which it viewed. 

Program 

<!Doctype html>

<html><body>

<table border= 1 width= 100>

<tr><td>

Table width is 100 pixel

</td></tr>

</table>

<Br>

<table border= 1 width= 100%>

<tr><td>

Table width is 100%

</tr></td>

</table>

</body>

</html>


width and height  tag output


Height and weight tag output

Related post

list attributes tag html
table tag attributes html
client side scripting language
php program to print number increasing pyramid
Advantage and Disadvantage of JavaScript