How Internet Explorer Handles Lists (ul and ol)

May 11th, 2009

Microsoft Internet Explorer (at least versions prior to 7) seems to have some annoying bugs concerning lists in HTML.

  1. Problem: Margin between list items (“li”). If you set the margin of a list item to 0px in CSS, IE will still show a gap between the list items.
    Fix: Set a width for the list item (“li”) and the list itself (“ul”, “ol”). 100% will do the trick in most cases.
    The margin issue is fixed by this but it leads us to the next problem:
  2. Problem: When you set a width for a list item in an ordered, that is, numbered list (“ol”), Internet Explorer won’t count properly anymore.
    Fix: I don’t know any.

WordPress: Display Recent Posts Anywhere

May 10th, 2009

I wanted to display the titles of recent blog entries on my start page.
Here’s the solution I came up with:

<ul id="recent_entries">
<?php get_archives('postbypost', '5', 'html', '', '', FALSE); ?>
</ul>

'5' specifies the number of posts to be displayed.
Just a little CSS styling for the list (#recent_entries li {...}) and that’s it.

WordPress: Recent Posts

Make Container div Grow With Floating divs

May 10th, 2009

A thing I just discovered when doing the new design for seafoid.org:
If you have a div that acts as a container for floating divs, it won’t grow with them.

Growing with floating divs

The trick is the following: insert this piece of code to the CSS of the container.

overflow: auto;
width: 100%

The width attribute is necessary for Internet Explorer versions prior to 7.

Hope that helps.