This tutorial explains how to design a beautiful form (Facebook inspired) using a clean CSS design with only <label> and <input> tags to simulate an HTML <table> structure. You can reuse all CSS/HTML elements to design your custom form for your web projects: Live preview Download this tutorial (HTML + CSS)Update: I solved an issue with Safari and Firefox, download the new zip file.Step 1: Input elements and labelsWhen you design a form (for example to Sign-in or Sign-up on your site), a fast solution to place all form elements in a page is add them into the table's cells. A good and simple alternative is using HTML <input> and <label> tags in this way:
...and the css code is the following:
...in this way, <span> element inside the <label> tag set the same width (70px) for the field descriptions to the left of each <input> element in your form, like if field description and input was placed in a table row with two horizontal cells.Update: to solve an issue with Safari (using size attribute) and with Firefox (problem to display correctly input label) I changed the following code:
with:
Step 2: Submit ButtonWhen you add a standard/unstyled button in a form (<input> or <button> tag) take a mind it looks different on different browser and OS. A good practice to uniform how it looks is to define a CSS class to apply to your button. Instead of <input> or <button> tag you can also use a simple link (<a> tag) like in this case (I designed and applyed "green" class to the link <a>):
...and CSS code for the "green" class is the following:
The final result is very nice and clean, ready to reuse in your projects. Download this tutorial (HTML + CSS)
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.