Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Tables...is that swearing?

Featured Replies

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

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.

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 ;)

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.

i use tables just for actual tabular data. Everything else is css. good luck :)

  • 2 weeks later...

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

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

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.