2011-11-03 11 views
16

के साथ 2 टेबल कैसे बनाना है, मैं दो टेबल (उसी पृष्ठ पर) रखना चाहता हूं जो अलग-अलग प्रस्तुत करना चाहिए (यानी प्रत्येक तालिका के लिए अलग-अलग सीएसएस का उपयोग करें)। क्या यह संभव है?एचटीएमएल: विभिन्न सीएसएस

+7

असाइन अलग सीएसएस प्रत्येक के लिए कक्षाएं? – trojanfoe

उत्तर

48

अपने html

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

<table class="table2"> 

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

अपने सीएसएस में:

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
बेशक

, बस दोनों तालिकाओं के लिए अलग सीएसएस वर्गों आवंटित।

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

.css

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

बेशक यह है!

उन दोनों को एक id दें और उसके अनुसार सीएसएस की स्थापना:

#table1 
{ 
    CSS for table1 
} 


#table2 
{ 
    CSS for table2 
} 
6

आप प्रत्येक तालिका के लिए विभिन्न वर्गों सौंपने होंगे।

डॉट '।' के साथ सीएसएस में एक कक्षा बनाएं। ऑपरेटर और प्रत्येक वर्ग के अंदर अपनी संपत्ति लिखें। उदाहरण के लिए,

.table1 { 
//some properties 
} 

.table2 { 
//Some other properties 
} 

और उन्हें अपने HTML कोड में उपयोग करें।

संबंधित मुद्दे