2011-11-03 101 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代码中使用它们。