I have the following CSS code:
tr.uprightTr
{
padding: 0px;
margin: 0px;
height: 10px;
border: none;
border-spacing: 0px;
}
td.uprightTd
{
padding: 0px;
margin: 0px;
height: 10px;
border: none;
border-spacing: 0px;
}
table.uprightTbl
{
padding: 0px;
margin: 0px;
border: none;
border-collapse: collapse;
border-spacing: 0px;
}
And the following HTML:
<table class="uprightTbl" cellpadding="0" cellspacing="0">
<tr class="uprightTr">
<td class="uprightTd"><input type="checkbox" /></td>
...
No matter what I tried, it keeps some space between elements. Any ideas on what I can try or might be doing wrong?
P.S: I also checked out the element on Chrome, element reaches the related css lines successfully.
The space between the table cells is controlled by the CELLSPACING attribute in the TABLE tag. By setting CELLSPACING to zero, you can remove all the space between the cells of your table.
To remove this space we can use the CSS border-collapsing Property. This Property is used to set the borders of the cell present inside the table and tells whether these cells will share a common border or not.
Complete HTML/CSS Course 2022 To create table in HTML, use the <table> tag. A table consist of rows and columns, which can be set using one or more <tr>, <th>, and <td> elements. A table row is defined by the <tr> tag. To set table header, use the <th> tag.
Did you try to add a CSS rule for all elements such as:
.uprightTbl * {
border: none;
border-collapse: collapse;
padding: 0;
margin: 0;
}
It may solve your problem.
Apply below styles:
border-spacing:0;
border-collapse:collapse;
This query is already present: Set cellpadding and cellspacing in CSS?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With