Forest - Follow

Mystical Forest

Based on a true story...

Previous Entry Add to Memories Tell a Friend Next Entry
A little CSS/HTML help?
Electronics
[info]mysticalforest
So I have an HTML/CSS problem.

Is there a way to have a bulleted list item (say using the ol and li tags) whose li item consists of two columns—including an image?

I was using a simple two-column one-row table within the li tags, but the problem is that the bullet won't align properly if I use a table. Namely, the bullet appears on the bottom of the table naturally or if I add an nbsp immediately after the li tag but before the table tag, then the bullet appears on a line above the table, which looks awful.

Is there a CSS trick (or HTML/table trick for that matter) I can employ to have two columns in a list item with the bullet appearing aligned with the top line of each column?

Here's a crude illustration:



(Leave a comment)
Does this do what you want? I'm not sure if you want the bullet and the text at the top of the cell, or just the bullet.

(replace curly-brackets with html brackets, as LJ is not cooperating with me so it just shows up at text for you)

{table}
{tr}{td valign=top}{ul}{li}text{/ul}{/td}{td}{img src="logo_corner.jpg"}{/td}{/tr}
{tr}{td valign=top}{ul}{li}text{/ul}{/td}{td}{img src="logo_corner.jpg"}{/td}{/tr}
{tr}{td valign=top}{ul}{li}text{/ul}{/td}{td}{img src="logo_corner.jpg"}{/td}{/tr}
{tr}{td valign=top}{ul}{li}text{/ul}{/td}{td}{img src="logo_corner.jpg"}{/td}{/tr}
{/table}

Couple of ways to do what you want to do.

In HTML you can do this:

<ul>
<li><div class="left">Text</div> <div class="right"><img></div></li>
</ul>

Then in the CSS you apply like this:

li .left, li .right { float: left; width: 50%;}

(Leave a comment)

Home