How to Prototype a Responsive Contact Form with HTML and CSS

Start with the layout your visitors will use. Then check keyboard focus and the email error at a narrow width before handing the form to whoever connects it to your site.

Build a contact form you can open in a browser

Use the free Fieldfolio HTML and CSS kit. In the extracted ZIP, open app/index.html in a modern browser. The workshop runs from the extracted files.

  1. Choose Contact. For this example, set the title to Juniper Cloud QC, choose the light theme and select the paired layout.
  2. Choose the error state and select Apply settings. Look for the email hint and error message. Use Tab to move through the controls and check that you can see which control has focus.
  3. Narrow the preview. The paired fields should stack when the form container runs out of room. Test the width of the container where the form will actually sit, such as a sidebar on a wide page.
  4. Select Download HTML and open the downloaded document. Check the title and the email error again. Select Download CSS if you want the reusable stylesheet separately.

In the checked example, the downloaded HTML included the stylesheet, and the email control referenced both the hint and the error text. The example button is a prototype control. Your site will need its own submission handler.

Save the editable design for the next revision

After applying changes, choose Save project. Use Open project JSON to bring the settings back into the workshop. Keep the JSON next to the generated HTML so you can reproduce the example and change the design later. In the checked example, saving the reopened project produced the same JSON bytes.

Bring the styles into your site

  1. Open samples/contact.html to see the markup, then include app/fieldfolio.css after your site’s base stylesheet.
  2. Use .ff on the form or its wrapper, .ff-grid on the field grid, and .ff-control on editable controls. Use .ff-full for an element that should span both columns.
  3. Give each input a visible label. When your validation detects an error, set aria-invalid="true" on the control and reference its specific error message in aria-describedby. Remove the error reference when the issue is fixed. Use unique IDs if the page has more than one form.

Before launch, connect and test submission and validation in your own application. On the actual page, check keyboard focus, narrow layouts, and what someone sees after a successful or failed submission.