CSS Table

CSS Table properties are border, border-collapse, width, height, padding, background-color, color, text-align which are used to design html table.

CSS Table Border :

CSS border property is used to give border for the table, th, tr and td tags.

Syntax :

<style>  
table, th, td {  
    border: 1px solid #000066;  
}  
</style>

CSS Table Border Collapse :

CSS Table Border Collapse property is used to collapse all borders in one border only in html.

Syntax :

<style>  
table, th, td {  
    border: 1px solid #336600;  
    border-collapse:collapse;
}  
</style> 

CSS Table width:

CSS Table width property is used to set width of table, th, tr and td tags in html

Syntax :

<style>  
table, th,tr,  td {  
    border: 1px solid #336600;  
    width:100px;
}  
</style>

CSS Table height:

CSS Table height property is used to set height of table, th, tr and td tags in html

Syntax :

<style>  
table, th, tr, td {  
    border: 1px solid #336600;  
    height:30px;
}  
</style>

 

CSS Table padding:

CSS Table padding property is used to set padding of table, th, tr and td tags in html

Syntax :

<style>  
table, th, tr, td {  
      padding:10px;
}  
</style>

CSS Table Text Alignment:

CSS Table text-align property is used to set text alignment to centre, left and right of table, th, tr and td tags in html

Syntax :

<style>  
table, th, tr, td {  
   text-align:center;
}  
</style>

CSS Table Text color:

CSS Table color property is used to set text color of table, th, tr and td tags in html

Syntax :

<style>  
table, th, tr, td {  
   color:#666666;
}  
</style>

CSS Table background color:

CSS Table background-color property is used to set background color of table, th, tr and td tags in html

Syntax :

<style>  
table, th, tr, td {  
   background-color:#FFFF66;
}  
</style>

 

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

30808