473,395 Members | 1,460 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,395 software developers and data experts.

Problems With CSS Form Layout

8
Good evening,

Site:
http://www.dryleague.com/newsite/register.aspx
CSS:
http://www.dryleague.com/newsite/css/main.css


I'm trying to layout my form completely with CSS and I've hit a snag. I would like all the labels in a single column and the controls in another, side-by-side. My drop-downs aren't displaying as I'd like and I'm sure it has to do with their widths relative to the width of the container but I can't figure out how to make this all work. I would like to keep the widths as they are now.

This problem occurs in both IE7 & FF3.

Any suggestions as to how I could get this to look the way I'd like it to?
Feb 26 '09 #1
12 3021
drhowarddrfine
7,435 Expert 4TB
You need to be more specific because I see everything lined up and I don't see any drop downs at all.
Feb 26 '09 #2
DDubya
8
That's odd... the link above works fine for me.

Here's a screenshot:

Feb 26 '09 #3
TheServant
1,168 Expert 1GB
Do you mean the dropdown for gender or the reason label and dropdown are not working? Or both?
Feb 26 '09 #4
DDubya
8
I'd need the gender/sex dropdown to appear beside the 'Sex' label. It's currently appearing to the left of the Age dropdown.

Then I need the 'Reason' label to appear below the 'Sex' label with the Reason dropdown to the left the 'Reason' label.
Feb 27 '09 #5
Dormilich
8,658 Expert Mod 8TB
Opera 9.63 / WinXP is totally screwed up....
Feb 27 '09 #6
David Laakso
397 Expert 256MB
Opera 9.63 / WinXP is totally screwed up....
Is there an operating system/browser on the face of the earth that is rendering this as intended?

Time to re-think the construct me thi/m/k.
Feb 27 '09 #7
DDubya
8
I added a few more fields which made things even worse. I'll probably just do the layout with tables... as blasphemous as it may be to say..

It is tabular data... the data's just entered by users.
(that's how I'll sleep at night)
Feb 27 '09 #8
TheServant
1,168 Expert 1GB
That's fine, but come back to it in a month or so and try again. Trust me, it can be difficult but you can get rid of tables. I tried and tried and gave up, but after coming back and doing a re-vamp of my site I am table-less and using Strict HTML which was not possible about 3 months ago.
Feb 28 '09 #9
DDubya
8
I began this site with an "absolutely no tables" mindset. I was bound and determined to do everything with CSS and I think I've succeeded for the most-part.

However, my feelings have changed slightly as CSS seems to be more pain than gain when trying to produce tabular form layouts, in the following ways:

1) Form layouts are not easily maintained
If I decide to add a new row (label & field) and my label happens to be too wide, the entire layout goes out of whack. Then I'm into the .css file making minute adjustments to get it right, while table cells will automatically expand or wrap without changing everything around it. Vertical positioning is also must easier using tables and CSS even accounts for this (vertical-align).

2) Code is 'less' reusable
Pretty much for the same reason above. It may still be reusable but the over-head required to set everything up is much greater.

Keep in mind, I've used CSS for everything else in my form:
Expand|Select|Wrap|Line Numbers
  1. /* BOF: CONTACT FORM */
  2. table.form-contact {
  3.     margin: 40px auto 0px auto;
  4.     width: 480px;
  5. }
  6.  
  7. table.form-contact label {
  8.     margin-right: 10px;
  9.     text-align: right;
  10.     font-weight: bold;
  11.     color: #069;
  12. }
  13.  
  14. table.form-contact label.notRequired {
  15.     font-style: italic;
  16.     font-weight: normal;
  17. }
  18.  
  19. table.form-contact td {
  20.     text-align: right;
  21.     vertical-align: top;
  22. }
  23.  
  24. table.form-contact td+td {
  25.     text-align: left;
  26. }
  27.  
  28. table.form-contact input, textarea, select {
  29.     margin: 0px 0px 10px 0px;
  30.     border: solid 1px #ABB;
  31. }
  32.  
  33. table.form-contact input, textarea {
  34.     width: 250px;
  35.     padding: 2px;
  36.     font-family: inherit;
  37.     font-size: 90%;
  38. }
  39.  
  40. table.form-contact textarea {
  41.     width: 357px;
  42.     height: 90px;
  43. }
  44.  
  45. table.form-contact input:focus, select:focus, textarea:focus {
  46.     border: solid 1px #069;
  47. }
  48.  
  49. table.form-contact input.btnSubmit {
  50.     margin-right: 6px;
  51.     width: 80px;
  52.     padding: 0px;
  53.     float: right;
  54.     border-width: 2px;
  55.     background-color: #FFF;
  56.     text-transform: uppercase;
  57.     font-weight: bold;
  58.     font-size: 85%;
  59.     color: #069;
  60. }
  61.  
  62. table.form-contact div.errorSummary {
  63.     margin: 10px 0px 10px 100px;
  64.     text-align: left;
  65. }
  66. /* EOF: CONTACT FORM */
In my personal opinion, I can use the CSS above with any 2-column input form in any site/application. The only things I'll ever need to change are the colours... possibly the margins.

I don't know if I'll try this again... unless you can convince me.. ;)

Just because something's more difficult doesn't always make it better.

That said, thanks to all for their input... and sorry for ranting..
Feb 28 '09 #10
TheServant
1,168 Expert 1GB
If all you want is a 2-column layout, I have used this website to have much better forms. Honestly, tables slow down the page load slightly, but it's really about coding properly. It is hard to break old habits, but it is quicker and more robust if done properly. Check out the resource and let me know if it helps.
Mar 1 '09 #11
Here are a few more-- you'll want to look for the more complex CSS form examples out there because it's easy to style a form when none of the labels are long enough to wrap : )

http://imaginekitty.com/formXHTML.html
http://gtwebdev.com/workshop/forms/form.php (both use same technique of floated span inside the label)

One problem with labels that wrap is the inputs will want to stay as much near the top as possible. So far I've been manually setting them back down to the end of the question, but this is not acceptable in a truly dynamic form. But I haven't stopped looking.
Mar 4 '09 #12
There are several different ways in which you can lay out a form. The method you choose depends upon how long the form is, its purpose, how often it will be used by each person who has to fill it out, and, of course, the general aesthetics of the web page.

It's generally considered most efficient to have one form element per line, with the lines stacked sequentially one on top of the other, as most Western-language web pages are designed to scroll vertically rather than horizontally. This allows users to follow the path to completion easily and focus their attention on entering one piece of data at a time.

For each form element in a left-to-right reading system, it's logical to position the corresponding label in one of three ways:

* directly above the form element
* in a separate left column, left-aligned
* in a separate left column, right-aligned

Each of these approaches has its own advantages and its own look, so consider these options when you're deciding how to lay out a form for a particular page.

Labels that are positioned directly above a form element have been shown to be processed most quickly by users. The compact grouping between label and element reduces eye movement by allowing the user to observe both simultaneously -- here's an excellent article published by UXmatters. However, this type of positioning is rather utilitarian, and isn't the most aesthetically pleasing layout. It also has the disadvantage of occupying the most vertical space of the three layouts, which will make a long form even longer. Generally, top-positioned labels work well for short forms that are familiar to the user -- see the comment form in Figure 3, which is from a previous incarnation of the Dress For Dialogue web site.
--------------------------------------------------------------------------------
corporate recognition awards
Murphy for congress
Mar 25 '09 #13

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

Similar topics

0
by: Ralf Hornbeck | last post by:
Hi, I have just uploaded an older PHP project I have written by myself up to my new webserver. On this server PHP is running in version 4.3.2 and this seems to result in some trouble, since the...
3
by: Peter | last post by:
For some unknown reason my Form Layout Window has stopped showing a form on it. I can open & close the window, set docking on/off but no form. The right click start-up options are also greyed out....
1
by: Clive Moore | last post by:
I am trying to hide a drop down box in a form on a jsp page using the: style.visibility="hidden"; The form element is hidden ok but my problem is that the space still exists where the element...
17
by: FDYocum | last post by:
I am having problems with a Web site that I've designed and I am grinding my teeth in frustration. The pages are built around a table with four cells. The first cell is spanned two rows and is...
0
by: David | last post by:
Hi, I have the following Tables: JS_Customer JS_Job JS_Product JS_Pack The layout:
11
by: Ben Holness | last post by:
Hi all, I am having some trouble with some table code. It works fine in Internet Explorer, but the layout doesn't work correctly in Firefox 1.0.7 Is this a firefox bug, or am I missing...
3
by: KimberlyM | last post by:
This has been driving me crazy. I hope someone can help. The site displays perfectly in FF but all div's do not show in IE. Please help me find the problem! Thanks! Here is my css. ...
2
by: rustyc | last post by:
Well, here's my first post in this forum (other than saying 'HI' over in the hi forum ;-) As I said over there: ... for a little side project at home, I'm writing a ham radio web site in...
4
by: wolvenlied | last post by:
Hi, I'm having a few problems with the layout of the object on my form. I need them to stay in the same place on the background image I created but the problem is my application displays...
6
by: Liam Gibbs | last post by:
Hello everyone, I'm trying to program a church web site and I'm having a number of problems with the layout. The html is at http://www.altmarvel.net/Liam/index.html and the css is at...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.