Solved

form - input field spacing

Posted on 2008-10-20
3
176 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 60 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 60 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

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

707 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