Search code examples
csssemantic-markup

How do you know if your data is displayed semantically correct as a table or something else?


I have information from a database. It is one row. Now, it is old, and tables were used to display the data. It works but is ugly and hard to maintain. I'm "fixing" it. But, I don't know if it is considered tabular or not. It comes from database tables, but I don't know that what it means to be semantically correct in using a table for display.

I have several sections like this on a webpages. They are all calls to the same database, different sets of data, sectioned off in the webpage.

For example, one set is a general set of information, lastname, firstname, middle, other stats...

Next section might be address, etc.

A while back when I did asp.net forms there was a list view, I think that was similar to what I need to create (I'm using just straight html and a scripting language, no controls).

How should I be displaying the information to be semantically correct?

edit: It is one person that does not repeat.

edit: A single record, but displayed on the same page, just various SELECT statements to get that data all on the same page.


Solution

  • If it's tabular data (i.e. multiple records displayed underneath each other) then a <table> would probably be the best choice. If it's a view of a single record, maybe even aggregating data from multiple tables then the <table> shouldn't be your first choice.

    Tabular data:

     --------------------------------
    | ID | Name | Description | Date |  
     --------------------------------
    | 01 | ...  | ...         | ...  |
    | 02 | ...  | ...         | ...  |
    

    Not tabular data:

    ID:          ...
    Name:        ...
    Description: .................
                 .................
                 .....
    
    Date:        ....