2016-08-01 57 views
0

是否有可用的HTML屬性等效於CSS屬性border-collapse: collapse;使用HTML屬性border-collapse

我想實現與HTML僅相同的1px邊框,而不是使用CSS。

table{ 
 
    border-collapse: collapse; 
 
}
<table border="1px" cellpadding="3"> 
 
    <tr> 
 
<td>Row 1</td> 
 
<td>Row 1</td> 
 
<td>Row 1</td> 
 
    </tr> 
 
    <tr> 
 
<td>Row 2</td> 
 
<td>Row 2</td> 
 
<td>Row 2</td> 
 
    </tr> 
 
</table>

回答

0

你可以嘗試cellspacing

<table border="1px" cellspacing="0" cellpadding="3"> 
 
    <tr> 
 
<td>Row 1</td> 
 
<td>Row 1</td> 
 
<td>Row 1</td> 
 
    </tr> 
 
    <tr> 
 
<td>Row 2</td> 
 
<td>Row 2</td> 
 
<td>Row 2</td> 
 
    </tr> 
 
</table>

注:CELLSPACING不重疊相鄰小區,其CSS屬性確實的邊界。

+0

因此,它是'cell-spacing'或'cellspacing'? – Justinas

+0

@justinas錯字,儘管謝謝。 – divy3993

+0

不可能僅使用html製作完全1px的邊框? –

0

我不明白你爲什麼要停止使用CSS,因爲這是CSS做 您可以使用自舉的CSS是裏面包含過時。 欲瞭解更多信息,請訪問w3chools

<div class="container"> 
    <h2>Basic Table</h2> 
    <p>The .table class adds basic styling (light padding and only horizontal dividers) to a table:</p> 
    <table class="table"> 
    <thead> 
     <tr> 
     <th>Firstname</th> 
     <th>Lastname</th> 
     <th>Email</th> 
     </tr> 
    </thead> 
    <tbody> 
     <tr> 
     <td>John</td> 
     <td>Doe</td> 
     <td>[email protected]</td> 
     </tr> 
     <tr> 
     <td>Mary</td> 
     <td>Moe</td> 
     <td>[email protected]</td> 
     </tr> 
     <tr> 
     <td>July</td> 
     <td>Dooley</td> 
     <td>[email protected]</td> 
     </tr> 
    </tbody> 
    </table> 
</div>