1

Horizontally, I'm trying to glue left and right cells by "-" without any white space between them. So I tired to create a middle cell between them with content "-", but it has margin among three cells, so I wondered how do I get rid of the white space (padding and margin) between the middle cell and other cells?

HTML

<table id="test">
    <tr id="userr1">
        <th>Left</th>
        <th class="mid">-</th>
        <th>Right</th>
    </tr>
    <tr id="row1">
        <td>cell</td>
        <td class="mid">-</td>
        <td>cell</td>
    </tr>
    <tr id="row2">
        <td>cell</td>
        <td class="mid">-</td>
        <td>cell</td>
    </tr>
</table>

And the CSS:

#test, th, td {
    border: 1px solid black;
    margin: 0px;
}
.mid {
    border: none;
    padding: 0px;
    margin: 0px;
}
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Junjie Zhang
  • 123
  • 2
  • 6

2 Answers2

3

Try this https://jsfiddle.net/2Lzo9vfc/84/

table {
  border-collapse: collapse;
  border-spacing: 0;
}
Nenad Vracar
  • 118,580
  • 15
  • 151
  • 176
0

You're missing padding: 0px; for the

test, th, td {}

#test, th, td {
border:1px solid black;
margin:0px;
padding:0px;
  
}
Community
  • 1
  • 1
Man of Progress
  • 129
  • 2
  • 14