I have created the default web site from the menu of VS2017 using file - new - web site.
On the default.aspx web page, I want to place a text box that will span 100% of the web page. But, the best width I can get is about 25% of the web page in a browser. I have removed
all the code provided within the content tag and have only a textbox. Here is the code. This is the only change from the default web site.
I want to place a text box that will span 100% of the web page. But, the best width I can get is about 25% of the web page in a browser.
You define the width of textbox in percent, you should be aware that the percentage is based on the element's parent, please use F12 developer tools
Dom Explorer to select and check the width of it’s parent element.
I do a test on my side, which works for me.
With Regards,
Fei Han
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Member
5 Points
43 Posts
textbox width constrained VS2017 default web side
Dec 08, 2017 12:46 PM|TiredOldCat|LINK
Hi
I have created the default web site from the menu of VS2017 using file - new - web site.
On the default.aspx web page, I want to place a text box that will span 100% of the web page. But, the best width I can get is about 25% of the web page in a browser. I have removed all the code provided within the content tag and have only a textbox. Here is the code. This is the only change from the default web site.
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
<asp:TextBox ID="TextBox3" runat="server"
width="100%">
</asp:TextBox>
</asp:Content>
Any suggestions? Thanks for any help.
All-Star
40565 Points
6233 Posts
Microsoft
Re: textbox width constrained VS2017 default web side
Dec 11, 2017 08:00 AM|Fei Han - MSFT|LINK
Hi TiredOldCat,
You define the width of textbox in percent, you should be aware that the percentage is based on the element's parent, please use F12 developer tools Dom Explorer to select and check the width of it’s parent element.
I do a test on my side, which works for me.
With Regards,
Fei Han
Member
5 Points
43 Posts
Re: textbox width constrained VS2017 default web side
Dec 15, 2017 12:32 PM|TiredOldCat|LINK
Hi Fei
Thanks very much for the help. I have not yet used F12 DOM tools and you have now expanded my tool set so I am on a learning curve again.
Also, using style=width:100% works rather than the older width=100% for a text box is much better.
Have a nice day.
None
0 Points
1 Post
Re: textbox width constrained VS2017 default web side
Dec 19, 2017 09:11 AM|wikioozweb|LINK
hi fei
hank you so moch. i had a problem with this. your advise was so helpful.
please visit my site : wikiooz