473,398 Members | 2,335 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Forms and CSS - lining stuff up

S
Hello

Is there a recommended way to line up form fields with their labels so
that the label column is right justified and the fields are left justified?

Example:

http://www.dorseygraphics.com/review...getemplate/for
m.jpg

I need the labels to sit next to their respective fields and buttons, but
they need to be right justified. I'm not quite sure how to line this up
using CSS.

Any suggestions are appreciated.

Thanks,

---------------S

Oct 27 '05 #1
5 1913
S wrote:

Is there a recommended way to line up form fields with their labels so
that the label column is right justified and the fields are left justified?


Forms are considered by many to be tabular data. Use a table.

--
Reply email address is a bottomless spam bucket.
Please reply to the group so everyone can share.
Oct 27 '05 #2
S wrote:
Hello

Is there a recommended way to line up form fields with their labels so
that the label column is right justified and the fields are left justified?

Example:

http://www.dorseygraphics.com/review...getemplate/for
m.jpg

I need the labels to sit next to their respective fields and buttons, but
they need to be right justified. I'm not quite sure how to line this up
using CSS.

Any suggestions are appreciated.

Thanks,

---------------S


This should get you started:

..sectionwrapper { /* position as needed, etc. */ }
..wrapper { margin-bottom:-12px; }
/* to change the value for white space between lines to your preference */
..leftcell { width:100px; text-align:right; }
..rightcell { position:relative;left:2em;top:-1.2em; } /* positions the
fields */
/* named them leftcell and rightcell to visualyze as tables */
/* values should be changed to your needs - if needed at all - just try
it */
<div class="sectionwrapper">
<div class="wrapper">
<div class="leftcell">Name:</div>
<div class="rightcell"><input size="25" name="namequest"></div>

</div>
<div class="wrapper">
<div class="leftcell">Description:</div>
<div class="rightcell"><input size="25" name="descquest"></div>
</div>
/* .....etc........ */
</div>

--
Gus
Oct 28 '05 #3
On Thu, 27 Oct 2005, kchayka wrote:
S wrote:

Is there a recommended way to line up form fields with their
labels so that the label column is right justified and the fields
are left justified?


Forms are considered by many to be tabular data. Use a table.


It's a defensible option, for sure. But putting the label text and
the form control into different table cells prevents the use of the
implicit association variant of the <label> markup. So it's a
compromise.

In fact, the HTML spec picks up this point in so many words, when
describing the implicit association:

| Note that this technique cannot be used when a table is being used
| for layout, with the label in one cell and its associated control
| in another cell.

(from http://www.w3.org/TR/html401/interac....html#h-17.9.1)

regards
Oct 28 '05 #4
Alan J. Flavell wrote:
But putting the label text and
the form control into different table cells prevents the use of the
implicit association variant of the <label> markup.


Which IMHO is a strange thing. A text within a p element is part of the
paragraph, a text within a h1 is part of the headline, a text within a
caption is part of the caption, a form control within a label is part of
the label ... ooops.
--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)
Oct 28 '05 #5
Alan J. Flavell wrote:

putting the label text and
the form control into different table cells prevents the use of the
implicit association variant of the <label> markup.
Well then, use the explicit variant! :)

IE doesn't support the implicit variety, anyway, at least not without
including an explicit "for".
So it's a compromise.


I don't see it as such, though it is nice to have a choice. Use whatever
variant works best for your particular case.

--
Reply email address is a bottomless spam bucket.
Please reply to the group so everyone can share.
Oct 28 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: James A. Donald | last post by:
in a web page http://jim.com/econ/chap01p1.html I want the first link, pointing to the previous page in the presentation to line up with left hand edge of the page, and the last link,...
15
by: Joshua Kendall | last post by:
I have a script in which it keeps opening the same form instead of only one instance. I also need help with a form that has a password. Where do I put the actual password? can I use a database for...
20
by: Peter Oliphant | last post by:
How does one launch multiple forms in an application? Using Photoshop as an example, this application seems to be composed of many 'disjoint' forms. Yet, they all seem somewhat 'active' in...
10
by: morangolds | last post by:
Hi, I've been having a problem with C++ Windows Forms apps not "ending" when you close the form window. I've searched about this problem all over the place and most searches have lead me to...
4
by: Andrew Taylor | last post by:
I've been struggling for a long time with HTML_Quickform from PEAR. The concept is ideal, but, the implementation is (IMHO) a bit of a kludge. As a developer I want a quick and easy way to...
4
by: Adam | last post by:
I have four roughly square DIVs, all the same height, which I need to line up horizontally across the page. What would be the best way to do this? At the moment I have a very botched solution where...
1
by: tgmurray | last post by:
Hi everyone. I am getting the results I would like in Firefox and Netscape but unfortunately not in IE7. My problem is that my uordered lists is not lining up with an image that has been...
2
by: alexburi | last post by:
Hi, I'm having a problem with the bullets lining up correctly with text in each <li>. If there is only one line of text, the bullet matches. But if there are two lines of text or more, the bullet...
12
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms....
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.