2011-11-03 14 views

Odpowiedz

48

w HTML

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

<table class="table2"> 

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

W swojej 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 jak ten kod tworzę dwie tablice, ale chcę ustawić inny styl dla różnych tabel, czy możesz mi powiedzieć jak? – Meghna

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

lub

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

Oczywiście, wystarczy przypisać oddzielne klasy css do obu tabel.

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

.css

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

Oczywiście, że jest!

Daj im zarówno id i skonfigurować CSS odpowiednio:

#table1 
{ 
    CSS for table1 
} 


#table2 
{ 
    CSS for table2 
} 
6

Musisz przypisać różne zajęcia do każdej tabeli.

Utwórz klasę w CSS z kropką "." operator i napisz swoje właściwości w każdej klasie. Na przykład:

.table1 { 
//some properties 
} 

.table2 { 
//Some other properties 
} 

i użyj ich w swoim kodzie HTML.