Forms are an essential part of every website. No matter if you’re building a one-page checkout form or a complete user registration form, there’s a good chance you’ll need a form for the process.
While there’s no denying that forms can be tedious to create and, at times, tricky to get right, there are design patterns and tools that can help make the process easier and more efficient. In this article, we’ll cover five ways in which you can add a border around your form fields, ranging from simple to more advanced methods, so you can pick the right one for your situation.
Use a Divider
One of the most basic and, at the same time, one of the most effective methods of adding borders to form fields is with a divider. A divider is simply a line or bar placed around form fields, as shown in the example below:
The bar can be created with many different colors, forms, or styles, and it can be raised or lowered with a slider control, as shown in the screenshot above. The divider does two things: first, it clearly separates the different groups of form fields, such as email address, password, and so on; and second, it adds a bit of decoration to the form, making it look more professional.
If you decide that this is the simplest and most effective way to add a border to your form fields, then head over to your theme’s functions.php file and put the following code in there:
Use an H2 Tag
The H2 tag is one of the simplest ways to add a bit of design to your form, aside from the divider method mentioned above. The H2 tag makes it easier for users to find what they’re looking for and to navigate your form. For example, if you have a registration form with a large number of fields, you could use the H2 tag to highlight the required fields in red:
Then, wherever you have it, you could add a border around the form fields to provide a visual separation between the groups of form fields and add some decoration:
If this is the case, then using the H2 tag is the simplest and most convenient option. However, this method does have its drawbacks since the H2 tag is simply an HTML tag and, as such, it doesn’t offer any formatting options to the content that’s within it. As a result, the content will be displayed as it is without any changes, which can be a problem if your content doesn’t fit.
Use a Separator Line
A separator line is a simple way of visually separating one group of form fields from another. As mentioned by the name, it’s used to separate fields that should be filled in from those that should be left blank. The most basic and, at the same time, most effective way of doing this is with a dashed line:
This is, in fact, the pattern that WordPress uses to separate form fields, and it’s implemented quite simply: wherever you have a form field, you can add a dash between each one, as shown in the screenshot above.
Aside from dashes, you can use other methods to create a separator line, such as color, font, or any other formatting option that your theme supports.
Use a Label For The Column
Your first instinct when designing a form might be to simply add a field for the content that you have and, because it’s a form, to add an input or textarea for users to write their content in. However, there’s more than one way to skin this cat, and, at times, it can be more convenient to add a label for each column, as shown in the example below:
A label is simply a piece of text that appears next to a form field. If you decide that this is the best way to go, then you can add labels wherever you have form fields to provide explanations for what each field is for or to identify the specific requirement for the content. In the case below, the labels for the first four fields are used to provide an explanation for why a user needs to enter their name, email address, phone number, and website:
This is particularly useful when you have long, complicated forms with many fields and, as such, you want to keep the input areas at a minimum to avoid any usability problems. You can, of course, add more explanation next to each field.
The last method we’ll cover is the use of gradients. A gradient is simply a visual effect that’s used to add a bit of decoration or draw the eye to a particular area on a form. Your form fields shouldn’t be the only thing drawing the eye to your registration form. You can use a gradient to highlight important areas of the form, such as the field for entering a password, as shown in the example below:
Gradients allow you to add a bit of color or design to an area, and this can be a very effective way of drawing the eye to particular areas of your form.
The examples above are simply a small selection of the design patterns and tools that can be used to add borders and design elements to forms. If you decide that one of these methods is the best fit for your needs, then you can implement it into your design and have fun tweaking the appearance of your site.
As you can see, adding borders and design elements to your forms is simply a matter of choosing the right tool for the job. Remember: you’re the boss of your form!