Oleksandr
Oleksandr

Reputation: 3801

JavaScript GridView: TD VS DIV

Recently i've created very basic GridView implementation. There were a few problems, but non of them is unsolvable.

But one thing make me curious - which implementation is better: with TD elements or with DIV ?

HTML table is a very basic element and it was invented to create some sort of grid views - tables. But on other hand - div element - highly customisable and lightweight element.

P.S. I'm targeting mobile devices and result layout must contain as less elements as it possible.

UPD It's a bit confusing, but my GridView will be placed as a row in the list :)

Upvotes: 0

Views: 142

Answers (1)

Quentin
Quentin

Reputation: 943240

If the data has a tabular structure (i.e. each item has something in common with every item in the same row (but doesn't have that in common with items in other ros) and ditto for columns), then a table is the right tool. Otherwise, a table isn't.

Use the element that best describes the semantics of the data (with div being the last resort (and elements with incorrect semantics not being an option)).

Upvotes: 1

Related Questions