2011-11-03 241 views

回答

48

在HTML

<table class="table1"> 
<tr> 
<td> 
... 
</table> 

<table class="table2"> 

<tr> 
<td> 
... 
</table> 

在你的CSS:

table.table1 {...} 
table.table1 tr {...} 
table.table1 td {...} 

table.table2 {...} 
table.table2 tr {...} 
table.table2 td {...} 
+0

http://www.w3schools.com/html/tryit.asp?filename=tryhtml_table_border像這樣的代碼我創建兩個表,但我想爲不同的表放置不同的風格,你能告訴我怎麼做嗎? – Meghna

3
<table id="table1"></table> 
<table id="table2"></table> 

<table class="table1"></table> 
<table class="table2"></table> 
5

當然,只是分配單獨的CSS類兩個表。

<table class="style1"></table> 
<table class="style2"></table> 

的.css

table.style1 { //your css here} 
table.style2 { //your css here} 
3

當然是!

給他們倆一個id,並相應成立了CSS:

#table1 
{ 
    CSS for table1 
} 


#table2 
{ 
    CSS for table2 
} 
6

你需要不同類別分配給每個表。

使用點'。'在CSS中創建一個類。運算符並在每個類中編寫您的屬性。例如,

.table1 { 
//some properties 
} 

.table2 { 
//Some other properties 
} 

並在您的html代碼中使用它們。

相關問題