Jump to content

Input form with size=100% doesn't work?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
TheSourceOfX

TheSourceOfX

    Learning Programmer

  • Members
  • PipPipPip
  • 45 posts
Basically, I have this
<input type="text" size="100%">
and the result is the same as if I put
<input type="text" size="100">
which is MUCH larger than I need.

I also tried to do
width="100%"
but that didn't accomplish anything.

Does anyone know how to set the size of a form to fit it's parent container?

#2
TheSourceOfX

TheSourceOfX

    Learning Programmer

  • Members
  • PipPipPip
  • 45 posts
So I figure it out, and I'm telling you all this in case anyone saw my post and just didn't reply because they didn't know the answer. Supposedly this doesn't work on all browsers, although it seems to work on the latest Firefox, Chrome, and Opera at least. Instead of doing anything with the <input> tag you have to use the style and set width: 100%, like so
<input type="text" style="width: 100%;">
I believe the same can be done with any other form elements, and I don't see why the same couldn't work if you just made it part of a class with the same width style.

Hope this helps someone