How to size a submit button to match the textarea height?

Discussion in 'CSS' started by Sempiterna, Aug 30, 2010.

  1. #1
    I have been searching around for this, but haven't found a solution yet. Maybe anyone here has an idea on how to do the following:

    I have a textarea, and next to it is a submit button. I would like the submit button to be the same height as the textarea. And to make things even more difficult, a user can define how many rows the textarea is, and what the font size is. So basically, the button should be smaller or larger depending on what the user chooses the textarea size to be.
     
    Sempiterna, Aug 30, 2010 IP
  2. CSM

    CSM Active Member

    Messages:
    1,047
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    55
    #2
    Let's presume the textarea height is 200 pixels.. the submit button is then 200pixels too?

    Where is the sense?
     
    CSM, Aug 30, 2010 IP
  3. Sempiterna

    Sempiterna Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Well, the user defines the nr of rows that the textarea should be. If i knew how much px one row is, then i could size the button accordingly. But that information i can't find either. It probably also depends on the size of the font in px. I tried calculating the amount of rows times the size of the font, and then copy that value to the button, but that does not seem to work.
     
    Sempiterna, Aug 30, 2010 IP
  4. CSM

    CSM Active Member

    Messages:
    1,047
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    55
    #4
    But why you need a submit button that is the same height then the textarea? That's what I do not get :)

    I know that you can calculate height/width of an item with jquery.
     
    CSM, Aug 30, 2010 IP
  5. Sempiterna

    Sempiterna Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Maybe because it looks better in my application? :) I haven't found any jquery examples though.
     
    Sempiterna, Aug 31, 2010 IP
  6. CSM

    CSM Active Member

    Messages:
    1,047
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    55
    #6
    CSM, Aug 31, 2010 IP