Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

<table> or <div> ?

  • 18-07-2012 9:53am
    #1
    Registered Users, Registered Users 2 Posts: 7,836 ✭✭✭


    I’m creating my first website and I’m at the very early stages of design. I’d like to stay consistent with my design principles and so I’d like to now choose whether to use tables or div’s to create the structural outline of my pages.

    As somebody who is completely new to all of this don’t have any kind of historical commitment to one or the other. Since I am basically a blank slate what would be the best one to choose? This isn’t a commercial site and so time is not an issue. I plan on learning CSS either way so again that shouldn’t be an issue. I have used tables briefly in the past, so I understand their basic structure but I am not familiar with div’s at all.


Comments

  • Closed Accounts Posts: 34,809 ✭✭✭✭smash


    I'd always use divs. There's literally hundreds of articles about tables vs divs. From a quick google, here's the first result for you http://coding.smashingmagazine.com/2009/04/08/from-table-hell-to-div-hell/


  • Registered Users, Registered Users 2 Posts: 448 ✭✭gerarda


    Hi,
    I'm kinda new to web development too, you might take a look at:

    http://www.w3schools.com

    Its bursting with examples that you can edit to practice with plus it covers html, css, javascript amd more. I used it as a reference for my college project and found it very helpful.


  • Registered Users, Registered Users 2 Posts: 453 ✭✭Ant


    Tables are only for tabular data e.g. Displaying data that may have come from a spreadsheet. In the 90s, designers used to use table elements to get around the lack of compatibility between browsers in positioning page elements. Using div elements positioned with CSS has been the best practice for the past 10 years. Since you're learning, I'd recommend becoming familiar with the W3C and other related standards. See http://www.webstandards.org/learn/ for more info.


  • Closed Accounts Posts: 27,857 ✭✭✭✭Dave!


    There may be specific situations where tables are necessary or useful for layout (e.g. emails), but in general just go with best practice and use <divs>. It's makes much more sense semantically, and once you get good at CSS you'll have loads of flexibility in terms of layout. Tables are for tabular data.

    You might also start using some HTML5 elements like <header> and <footer> where appropriate.


  • Registered Users, Registered Users 2 Posts: 1,082 ✭✭✭Feathers


    Unless you deliberately want to do things badly, use divs. People choose tables as a hack before — no one thought it was good, but it worked. Now you don't need it, unless as Dave! says you're coding for compatibility for something like emails (or IE5 and below… if that's the case, please see your doctor as soon as possible).

    Especially if you're learning CSS anyway — you'll understand it a lot better if you understand how the natural page flow works. That's impossible with tables, as all of your content is locked into a grid.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 1,022 ✭✭✭eirman


    Tables are handy for forms etc. Even then, they should be within a div.

    Use css for layouts. Here is the first of many results when doing a search for "using css for layouts"
    http://webdesign.about.com/od/css/a/aa102102a.htm

    Or try this
    http://webdesign.about.com/b/2010/04/11/web-design-software-pick-of-the-week-css-layout-generator.htm


  • Registered Users, Registered Users 2 Posts: 15,065 ✭✭✭✭Malice


    Definitely only use tables for tabular data. You'll thank yourself in the long run.


  • Registered Users, Registered Users 2 Posts: 1,298 ✭✭✭off.the.walls


    I use divs unless i need to actually make a table like on a wiki site or something like that where you need a date a time and all the usual jazz, divs i also find alot easier to move around in css.


  • Registered Users, Registered Users 2 Posts: 8,488 ✭✭✭Goodshape


    divs + CSS, without a doubt.

    I'm curious where you even came across the idea of using tables. Any tutorial or teacher which is seriously suggesting that you do, is very out of date.


Advertisement