Click here to Skip to main content
14,603,943 members
Rate this:
Please Sign up or sign in to vote.
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?

<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

Rate this:
Please Sign up or sign in to vote.

Solution 1

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
}
   
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, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100