Input box 100% width?

Discussion in 'CSS' started by Triexa, Nov 3, 2006.

  1. #1
    I want my input boxes to fill the full available space. Whether that be a <td> with a set width or a simple line with some text before it...

    is there some way to accomplish this?
     
    Triexa, Nov 3, 2006 IP
  2. jacobbannier

    jacobbannier Active Member

    Messages:
    1,155
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    90
    #2
    maby by using css?
    input.search { width: 100%; border: none; background: #FFF url(input.gif); padding: 4px; color: #808080; }
    Code (markup):
     
    jacobbannier, Nov 3, 2006 IP
  3. Triexa

    Triexa Active Member

    Messages:
    580
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #3
    if you do 100% width then, it does ONE HUNDRED PERCENT width, regardless of what else is on the same line...
     
    Triexa, Nov 3, 2006 IP
  4. Triexa

    Triexa Active Member

    Messages:
    580
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #4
    OR how could I make the text box automatically adjust to the width of the text in it?
     
    Triexa, Nov 3, 2006 IP
  5. dp-user-1

    dp-user-1 Well-Known Member

    Messages:
    794
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    110
    #5
    Put it in a table and make the cell that has the text box 100% in width.

    Simple example:
    <table width="100%">
    <tr>
    <td>
    CONTENT GOES HERE
    </td>
    <td width="100%">
    <form>
    <input type="text" style="width: 100%;">
    </form>
    </td>
    </tr>
    </table>
    Code (markup):
     
    dp-user-1, Nov 5, 2006 IP
  6. Forcefield

    Forcefield Peon

    Messages:
    314
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Or you could create a div with a fixed pixel width and put the input box inside that with a width of 100%.
     
    Forcefield, Nov 9, 2006 IP
  7. dp-user-1

    dp-user-1 Well-Known Member

    Messages:
    794
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    110
  8. Triexa

    Triexa Active Member

    Messages:
    580
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #8
    Triexa, Nov 9, 2006 IP
  9. dp-user-1

    dp-user-1 Well-Known Member

    Messages:
    794
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    110
    #9
    No problem, when I saw it I remembered reading this thread a few days ago, so I dug it back up and posted.

    Enjoy!
     
    dp-user-1, Nov 10, 2006 IP