鍍金池/ 問(wèn)答/HTML5  HTML/ 怎么解決table使用了border-collapse:collapse屬性后,

怎么解決table使用了border-collapse:collapse屬性后,table周?chē)吙蛳У膯?wèn)題?

我在寫(xiě)一個(gè)table,給table的td加上邊框后,發(fā)現(xiàn)中間邊框特別粗,所以就使用border-collapse:collapse解決。但是使用之后發(fā)現(xiàn)表格周?chē)倪吙虿灰?jiàn)了,請(qǐng)問(wèn)這樣改怎么解決?
css部分的代碼如下

#tableWrap{width: 488px;height: 300px;margin: 0 auto;}
#tableWrap table{
               width: 100%;height: 100%;
               border-top-left-radius: 20px;
               border-top-right-radius: 20px;
               overflow: hidden;
               border-collapse: collapse;
              border: 1px solid #000;                
  }
#tableWrap tr{height: 35px;}
#tableWrap tbody>tr>td{
    border: 1px solid #000;
}
#tableWrap td{
             width: 80px;
            text-align: center;
            font-size: 14px;
            color: #000;
     }
#tableWrap thead>tr{background: #f00;}  

tableWrap是包裹table的div。

之后的變成了這樣
圖片描述

HTML大概布局上是這樣的

<div id="tableWrap">
            <table cellspacing="0" cellpadding="0">
                <thead>
                    <tr style="color: #fff;">
                        <th align="center" class="one">排名</th>
                        <th align="center" class="two">用戶</th>
                        <th align="center" class="three">手機(jī)號(hào)</th>
                        <th align="center" class="four">投資金額</th>
                        <th align="center" class="five">獎(jiǎng)勵(lì)</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td align="center" class="one num">dd</td>
                    </tr>
             </tbody>
            </table>
        </div>
                            

請(qǐng)問(wèn)怎么解決?

回答
編輯回答
浪蕩不羈
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
            box-sizing: border-box;     
        }
    #tableWrap{width: 488px;height: 300px;margin: 0 auto;  
                border-top-left-radius: 20px;
               border-top-right-radius: 20px;
               overflow: hidden;
               }
#tableWrap table{
               width: 100%;height: 100%;             
               border-collapse: collapse;
              border: 1px solid #000;    
                     
  }
#tableWrap tr{height: 35px;}
#tableWrap tbody>tr>td{
    border: 1px solid #000;
}
#tableWrap td{
             width: 80px;
            text-align: center;
            font-size: 14px;
            color: #000;
     }
#tableWrap thead>tr{background: #f00;border: 1px solid #f00}  
    </style>
</head>
<body>
        <div id="tableWrap">
                <table cellspacing="0" cellpadding="0">
                    <thead>
                        <tr style="color: #fff;">
                            <th align="center" class="one">排名</th>
                            <th align="center" class="two">用戶</th>
                            <th align="center" class="three">手機(jī)號(hào)</th>
                            <th align="center" class="four">投資金額</th>
                            <th align="center" class="five">獎(jiǎng)勵(lì)</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td align="center" class="one num">dd</td>
                            <td align="center" class="one num">dd</td>
                            <td align="center" class="one num">dd</td>
                            <td align="center" class="one num">dd</td>
                            <td align="center" class="one num">dd</td>
                        </tr>
                 </tbody>
                </table>
            </div>
                              
</body>
</html>
2018年1月17日 13:19