Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-25-2009, 05:07 PM   PM User | #1
pxlcreations
Regular Coder

 
Join Date: Oct 2009
Posts: 177
Thanks: 20
Thanked 2 Times in 1 Post
pxlcreations is an unknown quantity at this point
Stretch textbox width to size of screen?

Hello all, I am currently making a page for iPhones and I need a textbox to stretch across the screen with some padding on the other end. Here's my code:

Code:
<br><input type="checkbox" name="1" onChange = "enableDisableTextField(this)" class="check" /><input type="text" name="i[]" style="border:solid 1px #999999;width:100%;margin-right:10px;">
I'm not sure what to do to make it stretch, and the 100% isn't working either. Thanks!
pxlcreations is offline   Reply With Quote
Old 11-25-2009, 09:08 PM   PM User | #2
kristingish
New Coder

 
Join Date: Jun 2008
Location: Normal, IL
Posts: 45
Thanks: 3
Thanked 3 Times in 3 Posts
kristingish is an unknown quantity at this point
Question

try

Code:
<br><input type="checkbox" name="1" onChange = "enableDisableTextField(this)" class="check" /><input type="text" name="i[]" style="display:block;border:solid 1px #999999;width:100%;margin:0px 10px;">

Alternately you could try changing the text-align on the containing div/span whichever to center so that this all sits centered and then make the width 90%.

I hope that helps!

Kristin
kristingish is offline   Reply With Quote
Old 11-25-2009, 10:02 PM   PM User | #3
pxlcreations
Regular Coder

 
Join Date: Oct 2009
Posts: 177
Thanks: 20
Thanked 2 Times in 1 Post
pxlcreations is an unknown quantity at this point
Hmm, ok, that code didn't seem to do the trick (take a look at the screenshot below).

The only problem with the center is that I would like it to be flushed left and then the box is just as big as the screen, and if the user entered in more information then it would go to the next line (although that can probably be addressed after the fact).
Attached Thumbnails
Click image for larger version

Name:	Picture 1.png
Views:	62
Size:	12.3 KB
ID:	7971  

Last edited by pxlcreations; 11-26-2009 at 12:59 AM..
pxlcreations is offline   Reply With Quote
Old 11-25-2009, 10:27 PM   PM User | #4
kristingish
New Coder

 
Join Date: Jun 2008
Location: Normal, IL
Posts: 45
Thanks: 3
Thanked 3 Times in 3 Posts
kristingish is an unknown quantity at this point
Hi, there is no screenshot?

I am just wondering maybe if you changed it from input type="text" to input type="textarea" that you may have some more options as far as styling.

Then you can change the number of rows & cols as well for default view and give a character limit. The text should automatically wrap inside of it.

Let me know if that helps or see below:
http://www.highdots.com/css-editor/h.../textarea.html
kristingish is offline   Reply With Quote
Old 11-26-2009, 01:00 AM   PM User | #5
pxlcreations
Regular Coder

 
Join Date: Oct 2009
Posts: 177
Thanks: 20
Thanked 2 Times in 1 Post
pxlcreations is an unknown quantity at this point
Ok, thanks! Btw, I did forget the screenshot but I just added it above.
pxlcreations is offline   Reply With Quote
Old 11-26-2009, 01:23 AM   PM User | #6
kristingish
New Coder

 
Join Date: Jun 2008
Location: Normal, IL
Posts: 45
Thanks: 3
Thanked 3 Times in 3 Posts
kristingish is an unknown quantity at this point
ok I see the screenshot now.

I see the one box is all super long but am wondering why it isn't appearing like the others. I only have one line of code of yours.

Did my previous reply help at all?
kristingish is offline   Reply With Quote
Old 11-26-2009, 12:26 PM   PM User | #7
pxlcreations
Regular Coder

 
Join Date: Oct 2009
Posts: 177
Thanks: 20
Thanked 2 Times in 1 Post
pxlcreations is an unknown quantity at this point
Well what I did was I only put the 100% on one of the lines instead of all of them. I'm wondering how this would work though, because I want it to continue on if it's too long (if the user inputs too much information, it will wrap to the next line).
pxlcreations is offline   Reply With Quote
Old 11-26-2009, 06:34 PM   PM User | #8
kristingish
New Coder

 
Join Date: Jun 2008
Location: Normal, IL
Posts: 45
Thanks: 3
Thanked 3 Times in 3 Posts
kristingish is an unknown quantity at this point
In that case. Really think textarea instead of text is the write way to go. You can use textarea and still have it appear as though it's just one line but the text will auto wrap with the right size and character limitations. You coul also have it appear as a two row box and the text will keep wrapping and u can turn scroll on or off.
kristingish is offline   Reply With Quote
Old 11-28-2009, 04:07 PM   PM User | #9
pxlcreations
Regular Coder

 
Join Date: Oct 2009
Posts: 177
Thanks: 20
Thanked 2 Times in 1 Post
pxlcreations is an unknown quantity at this point
Ok, so what would the attributes be to make it one line with no scroll bar and have it adjust it's size according to page width? And thank you for all the help so far!
pxlcreations is offline   Reply With Quote
Old 11-30-2009, 01:28 AM   PM User | #10
kristingish
New Coder

 
Join Date: Jun 2008
Location: Normal, IL
Posts: 45
Thanks: 3
Thanked 3 Times in 3 Posts
kristingish is an unknown quantity at this point
Hi,

To make it only one line it would be:

<textarea rows="1" cols="your choice" class="magicaltext">

then the css would be like :

.magicaltext{
width:100%;}
kristingish is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:49 AM.


Advertisement
Log in to turn off these ads.