Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS design for large form - Design Advice

Tags:

html

css

forms

I have a large form that consists of all the input (text, checkbox, radio, etc...), I have them grouped together in a fieldset tag and a legend for each feildset. Each input has a label associated with it as well. My question is what is the best approach to display the information on one screen and take advantage of the horizontal real estate the user might or might not have?

I would love it to be all CSS with minimal (if any) table layout(s) as I think tables are for tablature data and not presentation. CSS3 and HTML5 are welcome as well.

Also I would like to have the ability to add branding as this might need to look like another site instead of the original site developed for.

What would be the best approach for this? I have the idea I would use li tags to do the horizontal look but I would like to break to the next line at the end of the screen (Think no scrolling horizontal but vertical is okay)

CSS Novice looking for design pattern advice

This is an example but I think I have around 50 fields

<!DOCTYPE HTML>
<html>
<head>
<title>Large Form</title>
</head>
<body>
<form action="">

<fieldset>
<legend>***</legend> 

<label for="fname">First Name</label><br />
<input type="text" name="fname" id="fname" value="" /><br /><br />

<label for="lname">Last Name</label><br />
<input type="text" name="lname" id="lname" value="" /><br /><br />

<label for="gender">Gender</label><br />
<select name="gender" id="gender">
    <option value="">-- select</option>
    <option value="male">Male</option>
    <option value="female">Female</option>
</select>

</fieldset>

<br />
<input type="submit" value="Submit" />
</form>
</body>

</html>
like image 568
Phill Pafford Avatar asked Dec 04 '22 10:12

Phill Pafford


1 Answers

The first thing that comes to mind is that you want to remove the <br/> tags from the form. If you need vertical space, use CSS padding and margins since they're easier to change and make spacing consistent.

With that out of the way, other than branding (which will influence the look and feel of the form the most) the things you want to consider the most are accessibility and ease of use. Your use of labels and unwillingness to use tables for layout are a good start for accessibility so I'm not going to mention it further.

For ease of use, you'll need to make sure that each field can be tabbed to (in an order that makes sense), has a clear, meaningful label, has no unnecessary validation rules (such as forbidding whitespace in a phone number - don't force the user to clean data that can be cleaned automatically) and those validation rules that are necessary have clear, easy to understand messages that appear, ideally, as the user is entering the data rather than waiting for the user to submit the form.

Each of your field sets should be visually grouped either by colour, with a border or some other method. Individual field set should not be broken up, but different field sets can be separate from each other as long as they are contextually different (like address versus interests, for example).

Since you're already grouping field sets, you can use them as your basic unit of page layout. Each set could be floated, for example, in order to maximimize horizontal usage regardless of the user's browser width. As long as the sets are visually distinct enough and are clearly labelled there shouldn't really be any issues with that.

If consistency is more your thing, then each field set should be separated from each other vertically. That would make sure the form is ordered and laid out the same way for every user. Again, the important thing is visual consistency and ease of use. Users are used to forms being laid out vertically so the wasted horizontal space of doing it that way shouldn't be a very big concern.

Just remember: you're making something that should be easy to use and not frustrating. The position of fields should reflect that: they should be natural, grouping like fields together and separating groups of like fields from dissimilar fields. As long as you're keeping that in mind you're probably in good shape.

And don't forget to do some quick usability tests to make sure your validations make sense and are clear.

like image 124
Welbog Avatar answered Jan 04 '23 12:01

Welbog