5 Replies - 2339 Views - Last Post: 05 November 2011 - 01:17 PM

#1 Cancos  Icon User is offline

  • D.I.C Head

Reputation: 8
  • View blog
  • Posts: 66
  • Joined: 04-February 09

Best Way to Create Tables?

Posted 03 November 2011 - 02:36 PM

After many searches online, I still can't determine what is the best practice for creating tables. Although CSS provides an elegant view, it seems that regular HTML tables are better for data retrieval from databases. I'm a novice when it comes to CSS and would gladly appreciate any type of idea or code that shows CSS Table Creations. This is not for homework or anything like that, but rather an interest for myself to become a better developer. Any help would be appreciated. Thanks in advance.

Is This A Good Question/Topic? 0
  • +

Replies To: Best Way to Create Tables?

#2 FrankC  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 46
  • Joined: 06-October 11

Re: Best Way to Create Tables?

Posted 03 November 2011 - 04:31 PM

These two tutorials will make you an expert in table creation: HTML and CSS.
Was This Post Helpful? 0
  • +
  • -

#3 Jstall  Icon User is offline

  • Lurker
  • member icon

Reputation: 434
  • View blog
  • Posts: 1,042
  • Joined: 08-March 09

Re: Best Way to Create Tables?

Posted 03 November 2011 - 04:51 PM

Hi,

I just want to stress that you should only use HTML tables for tabular data, and some people argue that even then it is not a good idea.

Never use tables for layout! I see allot of beginners do this and even see it taught in some web dev intro courses.

Lemur did a great writeup on tables you can find here - The Evil of Tables.
Was This Post Helpful? 0
  • +
  • -

#4 Cancos  Icon User is offline

  • D.I.C Head

Reputation: 8
  • View blog
  • Posts: 66
  • Joined: 04-February 09

Re: Best Way to Create Tables?

Posted 03 November 2011 - 06:18 PM

I really appreciate the links guys. That's what I had been reading from sites I found that tables were good for tabular data, in addition, it has been so troublesome applying styles and JQuery to tables. So messy @_@. Thanks again.
Was This Post Helpful? 0
  • +
  • -

#5 Cancos  Icon User is offline

  • D.I.C Head

Reputation: 8
  • View blog
  • Posts: 66
  • Joined: 04-February 09

Re: Best Way to Create Tables?

Posted 04 November 2011 - 09:51 AM

Just to be even more specific as to what I am asking, if I am trying to retrieve information from a Database, such as SQL, I can simply iterate through the result set and create a <tr> with its corresponding <td>for each result (This is just an example). So my confusion here is as to whether CSS can actually do the exact same thing but in CSS WITHOUT using tables, although it can have a LOOK and FEEL of a table to display a decent amount of results, yknow?....

This post has been edited by Cancos: 04 November 2011 - 09:52 AM

Was This Post Helpful? 0
  • +
  • -

#6 mhollis  Icon User is offline

  • D.I.C Head

Reputation: 16
  • View blog
  • Posts: 61
  • Joined: 10-April 10

Re: Best Way to Create Tables?

Posted 05 November 2011 - 01:17 PM

As you properly surmise, tabular data is very good for tables, so don't let the naysayers shoot you down.

I also, occasionally, put forms into tables because the result will be tabular data.

Here is why we're "against tables."

It was 1999 and we were looking to make search better. We were looking for something pure, like when the Worldwide Web was new and the content of the page was pretty much unformatted. So we said, "Why not take all of the formatting out of the web page and let content be king?" Why not create a website that is semantic that says what it is?

So, we came up with HTML4 and XHTML as a "better" way to describe a web page, taking formatting out of the actual page and placing that into a stylesheet that browsers could load separately. The search engines could read everything in the page and would have semantic tags that would tell a story, like <div class="header"> <div class="footer"> . Web browsers would get faster because, with a well-designed styles page, all formatting information would load only once.

As we approach decisions on HTML5, which has been supported for several years by all modern browsers (Microsoft's being antediluvian, mostly), we're putting more information into the tags, like <nav> <article> <header> <footer> <section> <aside> and so on. There is an attempt to begin checking the validity of text entry in forms with specific email fields, number fields and so on.

So taking out tables was an attempt to increase what a website makes available to a search engine in terms of what is where, what is important and what the meanings of the various pieces of a website are.

But a table that indicates there is tabular data within it, along with formatting through a stylesheet is still very valid in a web page. If you have tabular data, by all means, use tables. Using <div> tags to place tabular data can be just as cumbersome and bad practice as the kind of inline style code we tried to get away from after 1999.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1