By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,767 Members | 1,255 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,767 IT Pros & Developers. It's quick & easy.

aligning submit button with CSS

P: 27
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,
Feb 24 '07 #1
Share this Question
Share on Google+
2 Replies


Expert 100+
P: 1,892
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
Feb 25 '07 #2

drhowarddrfine
Expert 5K+
P: 7,435
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.
Feb 25 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.