update: revised based on feedback:
I inquired because I couldn't locate any documentation specifying where display:xxxx;
is permitted.
My curiosity stems from a belief that a rendering engine can interpret the concept of rendering a rectangle as a table-cell
instead of a block
, even without a surrounding table-row
.
However, my certainty is lacking...
I am not seeking workarounds involving scripting (I'm not opposed to it, just irrelevant to my query)
original:
I am still uncertain about certain display property values (e.g., those related to tables);
I require a table (or similar structure) that allows me to style the "row". The issue lies in the fact that the data requiring display essentially necessitates an HTML <table>
(meaning: I cannot control the content inside the cells, such as in an invoice - it's not simply formatting static data).
I could resolve my predicament by implementing the code snippet below, simply substituting the table elements accordingly (an abbreviated solution, hoping the intention is clear)
table
tr
td
td
td
tr
td
td
td
with
div
div
div display:table-cell;
div display:table-cell;
div display:table-cell;
div
div display:table-cell;
div display:table-cell;
div display:table-cell;
Instructing the inner DIV
elements to display as/like table-cell
ensures equal height and vertical alignment mimicking cell behavior, thereby resolving the issue
So once again, the question arises: Although it works, is this practice sanctioned?
What puzzles me is that the conventional approach I often encounter advises:
div **display:table**
div **display:table-row**
div display:table-cell;
div display:table-cell;
div display:table-cell;
div **display:table-row**
div display:table-cell;
div display:table-cell;
div display:table-cell;
yet this replicates the table, tr, td format (as expected), so why utilize it?
On another note (unexplored by me thus far), how would
table
tr **display:inline-block**
td
td
td
tr **display:inline-block**
td
td
td
The questions arise once more: Is using a "standalone or out-of-context" display: something permissible? And if it functions as anticipated, will it remain effective in the future too?