January 18, 201214 yr Hi all. As a beginner and trying to learn as much as possible I've done a fair bit of reading a variety of stuff and I know that web designers/developers say to steer clear of tables, bad practise, etc, etc, etc. BUT.....when they say this do they mean for overal layouts? Reason I ask is because I'm trying to get to grips with producing a contact form and the fair few examples I've seen are produced using a table structure. So can and is it okay to use a table for a form or should I just steer clear of tables altogether? Any tips/advice will be greatly appreciated thanks James
January 18, 201214 yr Yes. Tables are not for laying stuff out they are for tabular data only. Don't feel bad though, i've seen even the best code-smiths use tables to layout a contact form stating it's a table of elements. Personally i'd use a list as i see contact form s a list of items to be filled in but many would argue that is incorrect too.
January 18, 201214 yr Tables can have their place but generally they are not used any more for layout etc. Put it this way, you don't need to use tables for a contact form, so think about how you could do this with css3 and html5
January 18, 201214 yr just replace all tables with <li> elements and style them with css. This way you can use the forms you find online and style them the way you want them to. Mike is right, you are filling in a list of details so it makes sense to make them an list element. Although I have not found a 100% solid reason not to use tables, I have noticed much cleaner and less code with <li>, I use it for almost everything now, only table in my life is in the dining room. P.H.
January 30, 201214 yr My two cents for what it's worth... Coding books tend to lay everything out with tables because it's very easy for new coders to understand - they take the 'lazy short cut' of sticking to teaching language X and plain old HTML tables and avoid a lengthy CSS tutorial, which is another book. The truth is you'll need to learn about CSS and how to lay stuff out properly, regardless of what language you end up learning. That said, I've seen loads of coders use tables in everything from small sites to big corporate systems both in small and large companies (who should know better) but it's no excuse of course. Why are tables bad? In short, search engines interpret tables as 'tabular data', which is of lower importance than usual page content as it's usually 'a figure to support the conclusion' so I'd argue it hurts SEO but also, it hurts accessibility (throws off screen readers for the blind, etc). HTH
January 31, 201214 yr I started to read this thread and realised our registration form was still in a table layout (in my defense it was written before I started here). I am now in the process of updating it. I hate tables for layouts as that is not what they are intended for. They are for tables of data, not to control the layout. CSS gives you so much more control of the layout. I've worked with forms where one row is used for the label and the next for the form element itself. Moving the label cell to the side of the form element is such a fiddly process and inserting a new element is a headache as it can affect the layout of the whole table. You end up having to change colspans in 23 places. And you also end up drowning in mark up. Gareth
February 1, 201214 yr Yes that's a good point there - html should ideally be about content and CSS should describe how that content is displayed on different devices/displays (e.g. printer, screen, mobile, etc).
Create an account or sign in to comment