2017-02-20 90 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>