Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What HTML tag is most appropriate for display in a Grid or Table? (with specific needs)

I'm trying to build a CSS-based table that will be populated with information coming from a database.

What is the most appropriate tag to use for this structured data? I originally considered ul since each row is an unordered list of data... but then I uncovered some difficulties making it into a grid using CSS.

I'm now looking at DIV (inline?) and Span. There may be others. What tag would be considered the industry standard way of displaying a CSS based grid?

Although I'm interested in learning what's most appropriate one from a DOM-Theory perspective, ultimately I want clean code that is consistent among browsers... This may weed out the ul tag entirely.

What do the experts think?

Update

So it seems that everyone is recommending that I use a table for (duh) tabular data. The only reason I don't feel silly for asking this question is because my ASP.net grid vendor is having issues with a dynamically resizing grid... and allowing for the columns to be resized on the client.

The vendor claims that the reason columns are having issues with a resize is because of tables. They will be moving to a DIV based layout to fix the issue. I'll post a reference link shortly...

Search for the word "Based" and you will see the posting from a MVP who mentions the internal changes: http://stagev5.componentart.com/community/forums/t/60782.aspx

Update 2:

Perhaps a large non-table based grid will also render faster.

You might say I need a lot of scalibility (for a large rowset) and the ability to resize the panes. Very similar to how Outlook currently looks/operates:

alt text

Summary of needs: I'm looking for a Table approach that allows for:

  • Fast Rendering
  • Large Datasets
  • Rich formatting
  • The ability to resize outer container/div
  • When changing the width/height of outer container, the columns will keep the width property or grow, as defined in HTML
like image 570
makerofthings7 Avatar asked Aug 05 '10 21:08

makerofthings7


People also ask

Which tag is used to display tables HTML?

The <table> tag defines an HTML table. An HTML table consists of one <table> element and one or more <tr>, <th>, and <td> elements. The <tr> element defines a table row, the <th> element defines a table header, and the <td> element defines a table cell.

What are the HTML tags used to display the data in tabular form with example?

The tags used to create a table in HTML are: table: In HTML “table” tag is used to define a table. tr: For defining table rows, the “tr” tag is used. th: “th” stands for a table header, for defining table header “th” tag is used.

What are the 3 main tags in HTML?

There are four required tags in HTML. These are html, title, head and body. The table below shows you the opening and closing tag, a description and an example. These are the tags you put at the beginning and end of an HTML file.

What are the most useful tags in the HTML?

The most important tags for an HTML document is doctype, <html>, <head> and <body>. doctype is the doctype declaration type.


2 Answers

If it's a grid of data, it should be a <table>. It's fair enough to avoid using tables for layout, but if you have tabular data then that's exactly what tables are for.

like image 141
GaryF Avatar answered Sep 30 '22 20:09

GaryF


If you want a tabular or grid information display, then use the table element. It's there for a reason.

like image 34
poke Avatar answered Sep 30 '22 20:09

poke