Results 1 to 8 of 8

Thread: How To Align Text in Text Box (Top) Vertically

  1. #1
    Join Date
    Jan 2012
    Posts
    4
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default How To Align Text in Text Box (Top) Vertically

    Hi Please Help me in this,


    I have textfield of height 300px. and text in the textfiled get aligned vertically center automatically, i want it to be top Aligment.

    Please give me your suggestions.

  2. #2
    Join Date
    Nov 2006
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    690
    Thanks
    1
    Thanked 113 Times in 111 Posts

    Default

    Hi there arulllk,

    and a warm welcome to these forums.

    Which HTML element are you referring to when you say....
    I have textfield of height 300px.
    Perhaps you could supply us with the code that you are using, also.

    coothead

  3. #3
    Join Date
    Jan 2012
    Posts
    4
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Hi My code
    is
    <form>
    <input align="top" name="" type="text" class="textInput2" />
    </form>

    and my css is

    .textInput2
    {
    width: 170px;
    color: #000000;
    margin-top: 0px;
    margin-left: 5px;
    height:100px;
    padding-top:0px;
    vertical-align:top;
    }

    i want text in that text area vertically aligned to top

  4. #4
    Join Date
    Nov 2006
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    690
    Thanks
    1
    Thanked 113 Times in 111 Posts

    Default

    Hi there arulllk,

    I think that you should use the textarea element for your project...
    Code:
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en">
    <head>
    
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="language" content="english"> 
    <meta http-equiv="Content-Style-Type" content="text/css">
    
    <title></title>
    
    <style type="text/css">
    #textInput2 {
        width:170px;
        height:100px;
        margin-left:5px;
     }
    </style>
    
    </head>
    <body>
    
    <form action="#">
     <div>
      <textarea id="textInput2"  name="mytextarea"></textarea>
     </div>
    </form>
    
    </body>
    </html>
    
    coothead

  5. The Following User Says Thank You to coothead For This Useful Post:

    arulllk (01-09-2012)

  6. #5
    Join Date
    Jan 2012
    Posts
    4
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Hi coothead,

    Thank you for spending wonderful time of yours.

    Actually i did that only in my project and in ie if we use text area it shows scroller and with the help of css i get rid of it also.

    so what i am looking out is is there any way we can align the text in text box vertically top Just to know

    Any ways thanks to spend your time for me

  7. #6
    Join Date
    Nov 2006
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    690
    Thanks
    1
    Thanked 113 Times in 111 Posts

    Default

    Hi there arulllk,

    the input type="text" element is used for a single line of text.

    It does not matter what height you apply to this element, the text will always be vertically-aligned in the middle.

    coothead

  8. The Following User Says Thank You to coothead For This Useful Post:

    arulllk (01-09-2012)

  9. #7
    Join Date
    Jan 2012
    Posts
    4
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Thank You Very much

    Now i got it

    Thanks Very Much

  10. #8
    Join Date
    Nov 2006
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    690
    Thanks
    1
    Thanked 113 Times in 111 Posts

    Default

    No problem, you're very welcome.
    coothead

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •