How do you write specific data to an HTML table?

At what point does editable tabular data in HTML stop semantically being a table and start being a form?

  • Say for example you have a small table of key/value pairs, like a person's personal details.  It would seem to me that an HTML table would be a semantically correct way of marking this up.  However if you make the value's editable, could you still consider the data tabular enough to be marked up using a table?  In that case, is something like a contact form not just technically a list of key/value pairs, and therefore tabular data?

  • Answer:

    I don't think a table is the correct way to go. If you are asking for user input, you really should be using form elements. Tables are supposed to be used in presenting information, not collecting it. Tables are also not supposed to be used for layout purposes. Therefore I think what you want is a form. You could use CSS to create the look you want, but I think putting a form within a table is semantically incorrect and I would imagine also offers less accessibility.

Victoria Potvin at Quora Visit the source

Was this solution helpful to you?

Other answers

if you use the fieldset and label elements correctly with your form controls, you dont need a list or table or anything else. i wrap all controls in individual labels except for checkboxes. its really quite easy once you do it, you'll never need to use non form elements in your form again.

J. Albert Bowden II

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.