2015-04-12 86 views
1

這是我的Html代碼。我想在標籤<table>中添加兩個bootstrap屬性,例如(以表格爲邊界的&)。如何在html表標籤中添加兩個引導類屬性?

我想在表標記中使用這兩個類屬性 。

<table> 
    <thead> 
    <tr> 
     <th>Name</th> 
     <th>Address</th> 
    </tr> 
    </thead> 
    <tbody> 
     <tr> 
     <td>anmol</td> 
     <td>america</td> 
     </tr> 
    </tbody> 
</table> 
+0

基本規則是:一個HTML標籤在'id'屬性中最多可以有一個id,但'class'屬性中可以有很多類(以空格分隔)。在你的情況下,「table-bordered」和「table-striped」是2個類名。 –

回答

3
<table class="table table-bordered table-striped"> 

,只要你想你可以添加儘可能多的參加。不要忘記添加基類。表

0

After doing some research in google i am able to use those both 
 
class properties by doing this.. 
 

 
<table class="table-bordered table-striped"> 
 
    <thead> 
 
    <tr> 
 
     <th>Name</th> 
 
     <th>Address</th> 
 
    </tr> 
 
    </thead> 
 
    <tbody> 
 
     <tr> 
 
     <td>anmol</td> 
 
     <td>america</td> 
 
     </tr> 
 
    </tbody> 
 
</table>

0

它可以很容易地完成就像使用它像<table class='table table-bordered table-striped'>。如果你想使用一些不同的顏色,你也可以使用CSS。

tr:nth-child(odd) { 
 
    background: #ff0000; 
 
}
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"> 
 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> 
 
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script> 
 

 
<table class="table table-bordered table-striped"> 
 
    <thead> 
 
    <tr> 
 
     <th>Firstname</th> 
 
     <th>Lastname</th> 
 
     <th>Email</th> 
 
    </tr> 
 
    </thead> 
 
    <tbody> 
 
    <tr> 
 
     <td>Wasim</td> 
 
     <td>Doe</td> 
 
     <td>[email protected]</td> 
 
    </tr> 
 
    <tr> 
 
     <td>Mary</td> 
 
     <td>Moe</td> 
 
     <td>[email protected]</td> 
 
    </tr> 
 
    <tr> 
 
     <td>July</td> 
 
     <td>Dooley</td> 
 
     <td>[email protected]</td> 
 
    </tr> 
 
    </tbody> 
 
</table>

0
<table class="table table-bordered table-striped table-hover"> 

引導有許多類表。您可以向元素添加多個類。