João Pedro Sousa
João Pedro Sousa

Reputation: 105

Element size inside div

So i have a div with a textbox inside and for some reason i can't make the textbox wider than 50% of the div width. I tried to set the width manually in pixels but it will never grow more than that. In the design interface it grown normally but when i run the project it doesn't. Tried in all browsers, always the same result.

<div style="width:100%;text-align:left;display:table" runat="server" id="DIVAdd">
<asp:TextBox ID="TBDes" runat="server" Height="25px" Width="100%"></asp:TextBox>
</div>

Upvotes: 0

Views: 1241

Answers (2)

Jo&#227;o Pedro Sousa
Jo&#227;o Pedro Sousa

Reputation: 105

Ok so basically i was using a MS Template and in the css page Site.css was this

input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="select"] {
max-width: 280px;
}

Upvotes: 0

Nope
Nope

Reputation: 22329

The width attribute on an input element is only used for images.

You have to apply the width as a style.

<div style="width:100%;text-align:left;display:table" runat="server" id="DIVAdd">
<asp:TextBox ID="TBDes" runat="server" Height="25px" style="width: 100%"></asp:TextBox>
</div>

<div style="width:100%;text-align:left;display:table" runat="server" id="DIVAdd">
  <input type="textBox" ID="TBDes" runat="server" Height="25px" style="width: 100%" />
</div>


On the W3 Input Attribute Chart you can see what attributes apply to which type of input.

Upvotes: 1

Related Questions