2015-02-12 26 views
0

我在我的代碼中遇到了一個問題。我是html和css的新手,所以問題是當我在瀏覽器中打開時,我的table沒有在我的行之間顯示任何行。爲什麼我的桌子沒有排隊?

您可以在這裏看到的結果:

http://i57.tinypic.com/ibyreb.png

這裏是我的代碼部分:

<table class="table" border="1" style="background-color:#FFFFFF;border-collapse: collapse;;border:1px solid #000000;color:#000000;width:90%;" cellpadding="5" cellspacing="3"> 
    <th bgcolor="#545454">Header1</th> 
    <th bgcolor="#545454">Header2</th> 
    <th bgcolor="#545454">Header3</th> 
    <th bgcolor="#545454">Header4</th> 

    <tr> 
     <td>Table Cell</td> 
     <td>Table Cell</td> 
     <td>Table Cell</td> 
     <td>Table Cell</td> 
    </tr> 
    <tr> 
     <td bgcolor="#D1D1D1">Table Cell</td> 
     <td bgcolor="#D1D1D1">Table Cell</td> 
     <td bgcolor="#D1D1D1">Table Cell</td> 
     <td bgcolor="#D1D1D1">Table Cell</td> 
    </tr> 
    <tr> 
     <td>Table Cell</td> 
     <td>Table Cell</td> 
     <td>Table Cell</td> 
     <td>Table Cell</td> 
    </tr> 
    <tr> 
     <td bgcolor="#D1D1D1">Table Cell</td> 
     <td bgcolor="#D1D1D1">Table Cell</td> 
     <td bgcolor="#D1D1D1">Table Cell</td> 
     <td bgcolor="#D1D1D1">Table Cell</td> 
    </tr> 
</table> 

這裏是我的CSS:

.table{ 
    background-color:#FFFFFF; 
    border-collapse: collapse; 
    border:1px solid #000000; 
    color:#000000;width:90%; 
} 

回答

2

風格的TD標籤

td 
{ 
border:solid 1px #000; 
border-collapse:collapse; 
} 

Hoep這有助於

+0

是的,它有助於非常感謝你 – 2015-02-12 08:07:18

1

你只風格的。表。 嘗試造型的td。 fe

table, th, td { 
    border: 1px solid black; 
} 

你還用背景顏色設計了彼此的行。你也可以在你的css文件中做到這一點,而不是內聯

tr:nth-child(odd) { 
    bgcolor="#D1D1D1" 
}