Solved

Aligning Fields On A Form

Posted on 2014-01-28
3
207 Views
Last Modified: 2014-01-28
I have a contact form that I want to be in the center of the page but the fields to be left aligned.  How can I do this?  Thanks.
<div align="center"><h2>Contact Form</h2></div>
<div align="center">
<form action="contact.php" method="post">
	Your name<br>
    <input type="text" name="cf_name"><br>
    Your e-mail<br>
    <input type="text" name="cf_email"><br>
	Message<br>
    <textarea name="cf_message"></textarea><br>
    <p>&nbsp;</p>
<input type="submit" value="Send">
<input type="reset" value="Clear">
</form>
</div>

Open in new window


The link:
http://www.mediascrubber.com/contactemploy.html
0
Comment
Question by:DS928
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 4

Expert Comment

by:ravikantninave
ID: 39815721
Use Div or simply Table;
<style>
.LeftDiv{width:100px; float:left;}
.RightDiv{width:150px; float:left;}
.Clear {clear:both;}
</style>


<div align="center"><h2>Contact Form</h2></div>
<div style="width:500px; margin:auto;">
<form action="contact.php" method="post">
<div class="LeftDiv">Your name</div>
<div class="RightDiv"><input type="text" name="cf_name"></div><div class="Clear"></div>
<div class="LeftDiv">Your e-mail<br></div>
<div class="RightDiv"><input type="text" name="cf_email"></div><div class="Clear"></div>
<div class="LeftDiv">Message</div>
<div class="RightDiv"><textarea name="cf_message"></textarea></div><div class="Clear"></div>
    <p>&nbsp;</p>
<input type="submit" value="Send">
<input type="reset" value="Clear">
</form>
</div>

Open in new window

0
 
LVL 4

Accepted Solution

by:
ravikantninave earned 500 total points
ID: 39815737
or
<div align="center"><h2>Contact Form</h2></div>
<div style="width:500px; margin:auto;">
<form action="contact.php" method="post">
<table style=" border:none;">
<tr>
<td>Your name</td>
<td><input type="text" name="cf_name"></td>
</tr>
<tr>
<td>Your e-mail<br></td>
<td><input type="text" name="cf_email"></td>
</tr>
<tr>
<td>Message</td>
<td><textarea name="cf_message"></textarea></td>
</tr>
</table>
    <p>&nbsp;</p>
<input type="submit" value="Send">
<input type="reset" value="Clear">
</form>
</div>

Open in new window

0
 

Author Closing Comment

by:DS928
ID: 39815914
Excellent!  Thank you.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question