Hi,
I have a new website that, because of reasons, I'd really like to use ul tags and have it display however I want with css, if at all possible.
In that vein, I have something like the following code:
Basically, if the top-level ul (in this case, belonging to class level1listing, though that can change) has the class "columns," then I want the list underneath it to display in a table layout:
[pre]
-------------------------------------------------------------------
| Header for column 1 | Header for column 2 | Header for column 3 |
-------------------------------------------------------------------
| First item in | | |
| column 1 | | |
| Second item in | | |
| column 1 | | |
-------------------------------------------------------------------
[/pre]
Basically, the reason for this is that the underlying code needs to be able to iterate through a recordset and handle records returned in the above order in all cases (not just the relatively-rare column layout cases), so I really need something that can handle html that's written in that order. If I can keep using ul tags instead of, say, divs (or heaven forbid, tables, which would be... kind of impossible, actually, with the way the recordset is ordered), that would be great. I could switch to divs if I absolutely have to, though.
The ids in the li tags are dynamically generated, so they can't really be used.
I've tried various permutations of display: table, but I think I just don't quite understand it, because the layout never seems to work. Either the first column appears correctly, but the second two columns appear as table cells, or each of the header items display as block, etc. :-(
Is this even possible? If so, how can it be done? I'm generally open to just about everything, unless it involves changing the order in which the items go in the html generation, because I don't think that can be done, at least not with my current PHP ability.
Many thanks!
Katie
I have a new website that, because of reasons, I'd really like to use ul tags and have it display however I want with css, if at all possible.
In that vein, I have something like the following code:
HTML:
<ul class="level1listing columns 3cols">
<li id="col1head" class="header">Header for column 1</li>
<ul class="level2listing list">
<li id="col1item1" class="none">First item in column 1</li>
<li id="col1item2" class="none">Second item in column 1</li>
</ul>
<li id="col2head" class="header">Header for column 2</li>
<li id="col3head" class="header">Header for column 3</li>
</ul>
Basically, if the top-level ul (in this case, belonging to class level1listing, though that can change) has the class "columns," then I want the list underneath it to display in a table layout:
[pre]
-------------------------------------------------------------------
| Header for column 1 | Header for column 2 | Header for column 3 |
-------------------------------------------------------------------
| First item in | | |
| column 1 | | |
| Second item in | | |
| column 1 | | |
-------------------------------------------------------------------
[/pre]
Basically, the reason for this is that the underlying code needs to be able to iterate through a recordset and handle records returned in the above order in all cases (not just the relatively-rare column layout cases), so I really need something that can handle html that's written in that order. If I can keep using ul tags instead of, say, divs (or heaven forbid, tables, which would be... kind of impossible, actually, with the way the recordset is ordered), that would be great. I could switch to divs if I absolutely have to, though.
The ids in the li tags are dynamically generated, so they can't really be used.
I've tried various permutations of display: table, but I think I just don't quite understand it, because the layout never seems to work. Either the first column appears correctly, but the second two columns appear as table cells, or each of the header items display as block, etc. :-(
Is this even possible? If so, how can it be done? I'm generally open to just about everything, unless it involves changing the order in which the items go in the html generation, because I don't think that can be done, at least not with my current PHP ability.
Many thanks!
Katie