Div With Margin-left And Width:100% Overflowing On The Right Side
Solution 1:
Just remove the width from both divs.
A div
is a block level element and will use all available space (unless you start floating or positioning them) so the outer div will automatically be 100% wide and the inner div will use all remaining space after setting the left margin.
I have added an example with a textarea
on jsfiddle.
Updated example with an input.
Solution 2:
A div is a block element and by default 100% wide. You should just have to set the textarea width to 100%.
Solution 3:
If some other portion of your layout is influencing the div
width you can set width:auto
and the div
(which is a block element) will fill the space
<divstyle="width:auto"><divstyle="margin-left:45px;width:auto"><asp:TextBoxID="txtTitle"runat="server"Width="100%"></asp:TextBox><br /></div></div>
If that's still not working we may need to see more of your layout HTML/CSS
Solution 4:
<divstyle="width:100%;"><divstyle="margin-left:45px;"><asp:TextBoxID="txtTitle"runat="server"Width="100%"></asp:TextBox><br /></div></div>
Solution 5:
Add some css either in the head or in a external document. asp:TextBox are rendered as input :
input {
width:100%;
}
Your html should look like : http://jsfiddle.net/c5WXA/
Note this will affect all your textbox : if you don't want this, give the containing div a class and specify the css.
.divClassinput {
width:100%;
}
Post a Comment for "Div With Margin-left And Width:100% Overflowing On The Right Side"