Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
511 views
in Technique[技术] by (71.8m points)

css - How to delete border spacing in table

I have a table, first row is like

<tr>
<th>1</th>
<th>2</th>
</tr>

I put a black background to "th". Now the 1 and 2 cells have some kind of border between/separating them... I had a look in source code and I think I found something:

border-collapse: separate;
border-spacing: 2px;

This CSS code is listed in source code as "user agent stylesheettable" and I couldn't enable/disable it to test if this is the problem, but I tried and added the same code but with "none" and "0" parameters but it didn't help neither...

Can somebody help and guide me where is the border from please?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Your table be like below by default and set the css rules on tables ID or Class

<table border="0" cellspacing="0" cellpadding="0">
 <tr>
  <th>1</th>
  <th>2</th>
</tr>
</table>

css:

border-collapse: collapse;

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.9k users

...