ad

Thursday, September 29, 2022

html Table Attributes

Web Designing  Theory

         Table Attributes Tag html tag          

       Table Attributes




Table tag :- 

1) Border Tag


The HTML tag use  border Attribute is used to  specify the border to the table  <table>tag. It set the border tag around the table cells. Attribute Values 1 It set the border tag around the table cell

This can be set around the table tag  by specifying values like 0 for no border is the showing around the table cells value 1 is set to display a border  tag 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 cellpadding Attribute use to  <table> tag   specify the space between the cell content and cell wall. The cellpadding attribute is a set  terms of pixels Attribute Values. pixels. It holds the space between the cell content and cell wall in terms of pixels.

Cellpadding set the amount of space between the contents of  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 is attribute  specifies the space between the cell as wall  the cell content. cell spacing tag  refer to the amount of space that is held between the cells in a table tag . It is specified with the cellspacing attribute tothe table element. Values are specified in number of pixels. Increasing the cell spacing results is wider shaded borders between cells. 

The cell spacing attribute place space around each the cell in the table. The Cellspacing attribute use to control the amount of the space between cells of a table. cell spacing refered to the  how space is left between each cell well in a  table in cellspacing 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>

</body>

</html>


Cellspacing Tag  output


Cellspacing Tag output



4) width and height  tag 

 The width attribute specifie the width of a table tag or the width of a. table cell. The width can be set either as  the absolute value in pixel or in percentage (%) .if the width attribute is not set it  will taks up the space of longest an 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 :-

html al navigation bar

html table program

css column-gap property

No comments:

Post a Comment