2014-01-17 68 views
0
#table1 
{ 
    font-family: Calibri; 
    font-size: 12pt; 
    font-style: normal; 
    text-align:center; 
    width:500px; 
    border-collapse: collapse; 
    border: 3px solid orange; 
    margin-right:80px 
} 

table,th,td{ 
    font-family: Calibri; 
    font-size: 12pt; 
    font-style: normal; 
    text-align:center; 
    width:500px; 
    border-collapse: collapse; 
    border: 3px solid red; 
    margin-right:80px 
} 

我使用2種不同類型的表的,有2種不同的顏色,但每當我試圖把th,td在表中的任何人,所有的表獲得顏色相同的顏色th,td表。表CSS格式

如何自定義每個表?

+0

你能提供的HTML代碼呢? – opalenzuela

+1

@Shashank:我不想聽起來粗魯......但你有沒有聽說過word => **格式化** ?? – NoobEditor

+0

*每當我嘗試把th,td放在桌子上的任何人* - 你好嗎?告訴我們你的嘗試,然後我們可以告訴你它有什麼問題。 – Quentin

回答

1

SAMPLE TABLE FIDDLE

<table class="mytable"></table> 

.mytable, mytable.th, mytable.td 
{ 
//some codes 
} 

<table id="table1"></table> 
#table1 
{ 
//some codes 
} 
1

您可以使用如下

//css 

     .table1{ 
      //table1 style 
     } 
     .table1 th{ 
     //th style for table1 class 
     } 
     .table1 td{ 
     //set color for table1 
     } 

     .table2{ 
     } 
     .table2 th{ 
     //set your color 
     } 
     .table2 td{ 
     //set color for table1 
     } 

    //html code 

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

     <table class="table2"> 
     <tr> 
      <th>.... </th> 
     </tr> 
     <tr> 
      <td>...</td> 
     </tr> 
     </table>