aligning submit button with CSS

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • JohnD
    New Member
    • Sep 2006
    • 27

    aligning submit button with CSS

    I am trying to align a submit button directly underneath a textarea box using CSS, I am at my wits end. Any suggestions on how I might do this?

    thanks,
  • AricC
    Recognized Expert Top Contributor
    • Oct 2006
    • 1885

    #2
    Originally posted by JohnD
    I am trying to align a submit button directly underneath a textarea box using CSS, I am at my wits end. Any suggestions on how I might do this?

    thanks,
    John,
    Post what you have so far, is it what you PM'd me? Don't worry we'll work through this :)


    Aric

    Comment

    • drhowarddrfine
      Recognized Expert Expert
      • Sep 2006
      • 7434

      #3
      The problem probably lies in the fact that <textarea> and the submit button are both form controls and inline elements. There are two ways to do what you want; maybe more.

      One is to convert <textarea> and <input> to block level elements like this:

      <form>
      <p style="width:30 %">
      <textarea style="display: block; width:100%"></textarea>
      <input type="submit" style="display: block; margin: 0 auto">
      </p>
      </form>

      I have the two elements wrapped in the <p> tag with the width set there. The text area becomes a block element the same width as the <p> with the submit button centered in the <p> also.

      The second way could be done using inline-block but I leave that as an exercise because I'm too lazy to do it.

      Comment

      Working...