Set cellpadding and cellspacing in table using CSS

Erik
Erik
2 Points
1 Posts

In html table we can set cellspacing, cellpadding and border like this

 <table width="100%" cellspacing="0" cellpadding="0" border="0">
    <tr>
     <td></td>
    </tr>
</table>

How we can set through css?

Total Answered: 3
Total Marked As Answer: 0
Posted On: 27-Dec-2018 07:42

Share:   fb twitter linkedin
Answers
Rashmi
Rashmi
Member
60 Points
20 Posts
     

Use following css class:

.table-css {
    padding: 0 0 0 0;
    margin: 0 0 0 0;
    border: none;
    border-spacing: 0;
}

.table-css tr td {
    padding: 0 0 0 0;
    margin: 0 0 0 0;
    border: none;
}
Posted On: 28-Dec-2018 01:35
Rahul Maurya
Rahul M...
Moderator
1160 Points
210 Posts
     

For "cellpadding", we can simply use padding on table cells using CSS. E.g. for 0px of "cellpadding":

td { padding: 0px;}

For "cellspacing", we can apply the border-spacing using CSS. E.g. for 0px of "cellspacing":

table { 
border-spacing: 0px;
border-collapse: separate;
}
Posted On: 29-Dec-2018 01:38
Olivia
Olivia
2 Points
1 Posts
     
table {  
    border-spacing: 0px;
    border-collapse: collapse;
}
th, td {
    padding: 0;
}
Posted On: 30-Dec-2018 04:13
banner

Blog

Active User (2)

 Log In to Chat