Click here to Skip to main content
15,891,657 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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?

ASP.NET
<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
Posted
Updated 21-Jan-16 17:21pm
v4
Comments
Richard Deeming 21-Jan-16 13:14pm    
I've fixed your code formatting, but your question is unclear. What is your desired output? What have you tried?
Member 12253249 21-Jan-16 23:22pm    
Thanks for the formatting Richard :). i need to increase the width of each th, but the width should be different for each th's. i have tried inline style for each th, but there is no effect.
Richard Deeming 22-Jan-16 13:27pm    
A table is just a grid. All the cells in a single column will have the same width. If you're trying to give them different widths in different rows, then it won't work.

1 solution

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:

CSS
.tblSWTable th {
  width: 200px
}
 
Share this answer
 
Comments
Karthik. A 21-Jan-16 13:36pm    
Seriously, down voter - care to say why?
Member 12253249 21-Jan-16 23:14pm    
i tried this. but its not working, i think its because of asp label.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900