Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Longer text input html

  • 17-04-2015 06:31PM
    #1
    Registered Users, Registered Users 2 Posts: 1,560 ✭✭✭


    How do I make a text input in html longer without imposing a maximum length?


Comments

  • Closed Accounts Posts: 9,700 ✭✭✭tricky D


    use maxlength="value" in the input field

    http://www.w3schools.com/tags/att_input_maxlength.asp

    allows a limit of just over half a million characters


  • Registered Users, Registered Users 2 Posts: 200 ✭✭druidhill


    I think you are asking with regards to display, so use the size attribute (default is 20).


  • Registered Users, Registered Users 2 Posts: 1,560 ✭✭✭quinnd6


    I meant the size of the input box on the screen as in how many characters fit into it onto the screen before you end up scrolling right to get to the next character.
    I think just setting a size does that anyway as druidhill just mentioned above.
    From experimentation there size doesn't seem to limit the amount of characters you can input.
    Am I right?


  • Registered Users, Registered Users 2 Posts: 200 ✭✭druidhill


    Yes, that would be my understanding too.


  • Registered Users, Registered Users 2 Posts: 2,015 ✭✭✭colm_c


    Use size attribute.

    Or just style it with a bit of css.

    HTML:
    [HTML]
    <input type="text" class="wide">

    <input type="text" class="narrow">
    [/HTML]

    CSS:
    input.wide {
    width: 100px;
    }
    
    input.narrow {
    width: 10px;
    }
    


  • Advertisement
  • Closed Accounts Posts: 9,700 ✭✭✭tricky D


    ^

    Note on the above: Try to use ems and percentages which work better for Responsive Design than pixels.


Advertisement