SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard
    Join Date
    Jun 2005
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question How do you align text on a form button please ?

    Has anyone come across a way of aligning the text on a form button please ? Have tried all different ways, but can't seem to get it right, the latest try is below :
    Code:
    <p><input style="width:64px; height:22px; font-size:14px; text-align:top;" type="button" name="Button" value="Convert" onClick="javascript:convert()">
    The styling needs to be within the form itself.

    Any help appreciated.

    Dez.

  2. #2
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The text-align property controls the horizontal alignment of inline boxes within the line box, so the value 'top' is not valid.

    You can't control the vertical text alignment within the button, as such. The vertical-align property will affect the alignment of the button itself. You can play with line-height and padding, perhaps.

    Another option is to use a <button> instead of an <input type="button">, since it allows for 'richer' content. But there are browser inconsistencies that can cause problems with that approach.

    (BTW, Dez, you should be posting these CSS questions in the CSS forum.)
    Birnam wood is come to Dunsinane

  3. #3
    SitePoint Wizard
    Join Date
    Jun 2005
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up

    Thanks Tommy, will play around with it a bit more.

    I did think of putting this into the CSS forum, but as it didn't involve a cascading style sheet, I didn't put it there. But no worries, will bear it in mind next time.

  4. #4
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dez View Post
    I did think of putting this into the CSS forum, but as it didn't involve a cascading style sheet, I didn't put it there.
    It does. Inline style attributes are also part of the CSS cascade.
    Birnam wood is come to Dunsinane


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
  •