Ruby
Ruby

Reputation: 969

border does not extend - css

The bottom border is only till the end of textboxes. I am working in visual studio 2010. The same code works fine in another PC. Why

<div style="clear: both; max-width: 2400px">
        <table style="border: 1px solid gray" width="100%">
            <tr>
                <td width="20%">
                    NAME
                </td>
                <td width="40%">
                    <asp:TextBox ID="TextBox1" runat="server" Width="98%"></asp:TextBox>
                </td>
                <td width="40%">
                </td>
            </tr>
            <tr>
                <td>
                    AGE
                </td>
                <td>
                    <asp:TextBox ID="TextBox2" runat="server" Width="98%"></asp:TextBox>
                </td>
            </tr>
        </table>
    </div>

enter image description here

Upvotes: 0

Views: 127

Answers (5)

Iren Patel
Iren Patel

Reputation: 757

Try this code...

<div style="clear: both; max-width: 2400px">
   <table style="border: 1px solid gray" width="100%">
      <tr>
        <td width="20%">
               NAME
        </td>
        <td width="40%">
          <asp:TextBox ID="TextBox1" runat="server" Width="98%"></asp:TextBox>
        </td>
        </tr>
        <tr>
        <td>
            AGE
        </td>
        <td width="40%">
        <asp:TextBox ID="TextBox2" runat="server" Width="98%"></asp:TextBox>
         </td>
        </tr>
        </table>
    </div>
</div>

Upvotes: 1

Shirin Abdolahi
Shirin Abdolahi

Reputation: 1067

you missed the third td ,if you want to only have two td in second tr,use colspan="2" in that td tag :

<div style="clear: both; max-width: 2400px">
        <table style="border: 1px solid gray" width="100%">
            <tr>
                <td width="20%">
                    NAME
                </td>
                <td width="40%">
                    <asp:TextBox ID="TextBox1" runat="server" Width="98%"></asp:TextBox>
                </td>
                <td width="40%">
                </td>
            </tr>
            <tr>
                <td>
                    AGE
                </td>
                <td colspan="2">
                    <asp:TextBox ID="TextBox2" runat="server" Width="98%"></asp:TextBox>
                </td>
            </tr>
        </table>
    </div>

Upvotes: 1

Ruddy
Ruddy

Reputation: 9923

You are indeed missing the third <td></td> or you can colspan= "2" one of the others

Upvotes: 1

Love Trivedi
Love Trivedi

Reputation: 4046

You missed the third td in second tr

<div style="clear: both; max-width: 2400px">
            <table style="border: 1px solid gray" width="100%">
                <tr>
                    <td width="20%">
                        NAME
                    </td>
                    <td width="40%">
                        <asp:TextBox ID="TextBox1" runat="server" Width="98%"></asp:TextBox>
                    </td>
                    <td width="40%">
                    </td>
                </tr>
                <tr>
                    <td>
                        AGE
                    </td>
                    <td>
                        <asp:TextBox ID="TextBox2" runat="server" Width="98%"></asp:TextBox>
                    </td>
                   <td>
                   </td>
            </tr>
        </table>
    </div>

Upvotes: 1

Ganesh Pandhere
Ganesh Pandhere

Reputation: 1652

You are missing third TD in second row. Insert it and it will show up.

<table style="border: 1px solid gray" width="100%">
        <tr>
            <td width="20%">
                NAME
            </td>
            <td width="40%">
                <asp:TextBox ID="TextBox1" runat="server" Width="98%"></asp:TextBox>
            </td>
            <td width="40%">
            </td>
        </tr>
        <tr>
            <td>
                AGE
            </td>
            <td>
                <asp:TextBox ID="TextBox2" runat="server" Width="98%"></asp:TextBox>
            </td>
            <td>
            </td>
        </tr>
    </table>

Upvotes: 1

Related Questions