By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,676 Members | 1,759 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,676 IT Pros & Developers. It's quick & easy.

Render <td> as display:block; ?

P: n/a
Background:
I have a bunch of (yet unwritten) code for a JSP tag library to
generate "tables" of data.The same tag library will be re-used to
generate a great many "complex data view" pages. In nearly all
contexts for this app, the appropriate HTML to generate is simple
<table... <td ... </tablemarkup, with CSS default rendering
applied to it. A database recordset maps quite simply column to
column, with the recordset column names used to caption the table
columns via <th>

I will be building an "entire table" tag for simple rapid prototyping,
but my intention is generally to require one tag to be embedded in the
JSP for each output "unit", typically a <td>...</td>. One of the
requirements is to make page and view design easily accessible to
coders who grok SQL and HTML / simple JSP tags, but who won't then
need to go near the Java that back-ends all this.

For a few of these columns (address etc.) it's appropriate to merge
these recordset columns into a single HTML unit (i.e. one <td>) and
separate them with <br>. Each tag will be regarded as generating "a
unit of content" in some abstract "table of data", but I don't want
the coders to think of them in terms of a "<tdgenerator tag".

In a very few cases (some of the pages) there could be very little
data involved here, even just a single row returned. I'd like to
abandon the <table>-like presentation here and use a handful of simple
<div>s or blocks, floated alongside each other.

My question is this:
Assuming I have to build the <tableand <tdgenerator, then do I
also need to build tag behaviour that will generate <divmarkup as
well? Or can I simply apply CSS of td { display: block; } and
switch it purely at the CSS presentation level, using the same
HTML?

I know I can do this in principle, but what's it like for widespread
browser support out in the real world?

Platform is an intranet app that's heavily contractually tied into
just running on IE7. Naturally I want something more than this, every
credible desktop browser of recent vintage. Non-desktop or small-
screen devices aren't too significant though.
Thanks for any thoughts on this approach, or on the CSS portability.
(If I get time for a HTML prototype today, I'll put it on-line and
post a URL)
Jan 16 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.