如何在html中添加样式到特定的th? [英] how to add style to a particular th in html?

查看:679
本文介绍了如何在html中添加样式到特定的th?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我的表格格式如下:现在我需要在某些 th 中应用css。我需要增加宽度。我几乎尝试了在互联网上找到的所有东西。我该如何处理这些?



 <  表格 >  
< tr class = abc >
< td > < asp:标签 ID = lbl < span class =code-attribute> runat = server 文字 = hyd > < ; / td >
< td > < asp:标签 ID = lblt runat = server 文本 = PS > < / td >
< ; / tr >
< tr class = tblSWTable >
< th > < asp:标签 ID = lbl11 runat = 服务器 文字 = abc > < / th >
< th > < span class =code-keyword>< asp:Label ID = lbl12 runat = server 文本 = abc > < / th >
< th > < span class =code-keyword>< asp:Label ID = lbl12 runat = server 文字 = abc > < / th >
< th > < asp:标签 ID = lbl14 runat = server 文本 = abc > < / th >
< / tr >
< span class =code-keyword><
/ table >





大约有25列。我需要增加第二行中每个th的宽度。



TIA

解决方案

您的问题有点不清楚。但我相信你需要这样的东西 - 小提琴 [ ^ ]。还添加了一些颜色!



您只需要为此定义css:



< pre lang =CSS>。 tblSWTable th {
宽度 200px
}


Hi,
I have a table format below: now I need to apply css in some th's. I need to increase the width. I have tried almost everything I found on internet. How can I go about these?

<table>
    <tr class="abc">
        <td> <asp:Label ID="lbl" runat="server" Text="hyd" ></td>
        <td> <asp:Label ID="lblt" runat="server" Text="PS" ></td>
    </tr>
    <tr class="tblSWTable">
        <th> <asp:Label ID="lbl11" runat="server" Text="abc" ></th>
        <th> <asp:Label ID="lbl12" runat="server" Text="abc" ></th>
        <th> <asp:Label ID="lbl12" runat="server" Text="abc" ></th>
        <th> <asp:Label ID="lbl14" runat="server" Text="abc" ></th>
    </tr>
</table>



There are around 25 columns. i need to increase the width of each th's in the second row.

TIA

解决方案

Your question is kind of unclear. But I believe you need something like this - fiddle[^]. Also added some color!

You just need to define the css for th like this:

.tblSWTable th {
  width: 200px
}


这篇关于如何在html中添加样式到特定的th?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆