Click to See Complete Forum and Search --> : Question about tables and forms


lunforgottenl
08-19-2007, 04:45 PM
Hello,

Just a quick question, should I layout my tabular data and forms using XHTML elements (<tr>'s, <td>'s etc... even though in some situations that is considered presentation) or should I use CSS instead?

Thanks,
John.

doodler
08-19-2007, 04:53 PM
The generel rule is to use CSS for presentation and (x)HTML for structure BUT that is not to say that something structured at the bottom of xHTML code will necessarily be rendered there by the browser because that depends on what/how you've told it to load (again, using CSS, if indeed you've used any).

Table can be used for presentation. But try using <div> in combination with CSS instead if you can.

lunforgottenl
08-19-2007, 05:23 PM
well I can use either <tr>'s and <td>'s to structure my form which is an easier method but in some situations that is considered presentation and not tabular data which is structure. So following the W3C standards, should I use CSS to layout my form or XHTML elements?

felgall
08-19-2007, 05:38 PM
The best way is to simply apply the appropriate floats and clears to the label and input fields so as to align them next to one another the way you want. (They also need to be display:block and have an appropriate width)

lunforgottenl
08-19-2007, 06:04 PM
yeah that make sense.... The hardest/longer path is often the most rewarding :) Thank you buddy.

ray326
08-19-2007, 10:32 PM
If you go the table route then the semantics would be labels in TH and inputs in TD. Here are some articles that should be interesting.

http://search.atomz.com/search/?sp-q=forms&x=0&y=0&sp-a=sp1002d27b&sp-f=ISO-8859-1&sp-p=All&sp-k=All

lunforgottenl
08-20-2007, 12:03 AM
yeah well if I go the table route is that ok? It is the easier way to get it done but some could say that tables are presentation and presentation should be done in CSS.... So what do professional programmers usually do, do they go for tables or CSS when laying out a <form>?

ray326
08-20-2007, 10:15 PM
CSS in general.

lunforgottenl
08-21-2007, 09:36 PM
alright thank you :)