I have some HTML structure like this:
<ul>
<li>
<h2>Item 1</h2>
<dl>
<div><dt>attr1</dt><dd>value a</dd></div>
<div><dt>attr2</dt><dd>value b</dd></div>
<div><dt>attr3</dt><dd>value c</dd></div>
</dl>
</li>
<li>
<h2>Item Another One Here</h2>
<dl>
<div><dt>attr1</dt><dd>value x</dd></div>
<div><dt>attr2</dt><dd>value some bit long</dd></div>
<div><dt>attr3</dt><dd>value z</dd></div>
</dl>
</li>
</ul>
I want it be rendered as:
---------------------------------------------------------------------
Item 1
attr 1: value a attr 2: value b attr 3: value c
---------------------------------------------------------------------
Item Another One Here
attr 1: value x attr 2: value some bit long attr 3: value z
---------------------------------------------------------------------
Attributes are aligned to each other based on the length of theirs contents.
How can I do that?
I would avoid change my markup to <table>
, since they are not really tables. I had tried layout them using display: table-*
, but that won't work for the title (which should take place of whole row instead of one cell).