?
Solved

form - input field spacing

Posted on 2008-10-20
3
Medium Priority
?
185 Views
Last Modified: 2013-11-19
having built a form and noticed the difference is field lengths proving to make it all look very untidy, I was wondering if it was possible to space the label out so they appear on the left and the field text input  boxes all started from the same place so it flows nicely down the page in a line. I know i can have some control over this with the" position: absolute " but was wondering if there was a better or easier way?

i also tried using the <p class="tag1"> but it then puts the field onto a new line??

any ideas
0
Comment
Question by:therob1
[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
3 Comments
 
LVL 16

Expert Comment

by:brad2575
ID: 22757526
an "EASY" way is to use tables and just seperate the label/form field in different TD columns.

You should be able to use stylesheets as well and a spacing length for the label and the form field.
0
 
LVL 42

Accepted Solution

by:
David S. earned 240 total points
ID: 22760010
Here's an example of how I prefer to do form layouts: http://www.dynamicsitesolutions.com/css/form-layout-example/
0
 
LVL 3

Assisted Solution

by:sbickerstaff
sbickerstaff earned 240 total points
ID: 22761452
using css only (having all textboxes / selects etc alligned left to the same point and all labels alligned right so they are all beside the boxes):

label {
  text-align: right;
  float: left;
  display: block;
  margin: 0 2px 0 0;
  width: 8em;
}

and then have (for example):

<div>
  <label for="username">Username:</label>
  <input type="text" name="username" id="username" />
</div>
<div>
  <label for="password">Password:</label>
  <input type="password" name="password" id="password" />
</div>

i would not recommend using tables as a lot of developers are moving towards using divs + css for layout instead of tables (if they're not alrady using that)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

770 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