2017-02-20 116 views
0

我有表中有一些行在那裏。我想在淘汰表中將td字體大小增加到24。如何在頭部爲td編寫css風格,以便增加所有td數據的字體大小。如何增加表中所有tds的字體大小

<table class="table table-striped"> 
 
    <thead> 
 
    <tr class="success"> 
 
     <th class="success">a</th> 
 
     <th>1</th> 
 
     <th>2</th> 
 
     <th>3</th> 
 
     <th>4</th> 
 
     <th>5</th> 
 
    </tr> 
 
    </thead> 
 
    <tbody> 
 
    <tr class="danger"> 
 
     <td id="hhh" class="success">filled</td> 
 
     @foreach (var item in Model) { 
 
     <td>@item.Filled.ToString("N2") cm</td> 
 
     } 
 
    </tr> 
 
    <tr class="info"> 
 
     <td>Updated time</td> 
 
     @foreach (var item in Model) { 
 
     <td>@item.UpdatedTime</td> 
 
     } 
 
    </tr> 
 
    <tr class="warning"> 
 
     <td>Area</td> 
 
     @foreach (var item in Model) { 
 
     <td>@item.Area</td> 
 
     } 
 
    </tr> 
 
    </tbody> 
 
</table>

+0

你想增加'只有th''字體size'? –

回答

3

可以嵌套的一切是這樣的:

table tbody tr td { 
    font-size: 24px; 
} 

或者你可以保持它簡單,只是做:

td { 
    font-size: 24px; 
} 

這取決於你的CSS的上下文,你需要具體如何。機會是第二種選擇。

+0

爲我工作..感謝 – Swapna

+0

我認爲你需要一個單位在你的'font-size',像'px' ... – tiffon

2

選擇table選擇,並給它一個style所有td元素就這麼簡單..

table td{ 
    font-size:24px; 
} 
1

檢查這個代碼

.table td { 
    font-size: 30px; 
} 

Live

1

U可以做到這一點直接烏爾HTML文件:

<style> 
table td { 
    font-size: 24px; 
} 
</style> 

<table class="table table-striped"> 
    ... 
</table> 

或U可以創建新的CSS文件的style.css

<link rel="stylesheet" type="text/css" href="style.css"> 

<table class="table table-striped"> 
    ... 
</table> 

,並在style.css會是:

table td { 
    font-size: 24px; 
} 
0

您還可以使用

<style> 
.mytable td{ 
    font-size:24px; 
} 
</style> 
<table class="mytable"> 
<tbody> 
    <tr> 
    <td>ABC</td> 
    <td>DEF</td> 
    </tr> 
</tbody> 
</table>