This is for Responsive Web Design, and I am looking in some existing code for how a form is done.
A coworker set the container div
of First Name label and <input>
and an "error message" under the input box, using CSS display: table
and display: table-cell
. He mentioned that it worked fine on Chrome and Firefox but had something weird on IE 8. Please see the simplified version on http://jsfiddle.net/DzEww/7/
This is so that the form can show nicely on any desktop browser and on mobile device that may be merely 320 pixel wide.
First, I wonder, is this a preferred method to do Responsive Web Design?
I wonder if we use CSS
table
andtable-cell
, then why don't we actually outright use HTML<table>
,<tr>
, and<td>
to do it? (example: http://jsfiddle.net/DzEww/12/) It feels a bit strange to use CSS table display to show it and expect it to be a structure of a table but not mark it up as a table. If we do expect the structure to be a table, then why don't we just directly use<table><tr><td>
to mark it up?
(Note that this form is really a good tabular of form labels and form fields, so using <table><tr><td>
might actually make a lot of sense.)