Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why a asp:DropDownList and a asp:TextBox of the same width appear differently

Tags:

html

c#

I am using the below code inside of a table:

<tr>
    <td>User Language:</td>
    <td>
        <asp:DropDownList ID="Language" runat="server" Width="200px">
            <asp:ListItem Selected="True">English</asp:ListItem>
        </asp:DropDownList>
    </td>
</tr>
<tr>
    <td><span class="important">*</span>Company:</td>
    <td><asp:TextBox ID="Company" runat="server" width="200px" /></td>
</tr>

When the code appears on the site the <asp:Textbox> control is 205px and the <asp:DropDownList> is 200px wide. What is causing that? They both are set to a width of 200px.

like image 278
Ben Hoffman Avatar asked Feb 11 '10 22:02

Ben Hoffman


1 Answers

Because the textbox has 2px of border and 1px of padding on the sides.

like image 66
Pent Ploompuu Avatar answered Nov 16 '22 03:11

Pent Ploompuu