tags:

views:

22

answers:

1

I'm having a little trouble having this behave exactly as I want across all browsers, but I swear I've done this before:

<!html>
<head>
    <style type="text/css">
    div { width:300px; }
    ul { list-style:none; margin:0; padding:0; }
    li { margin:0.25em 0.5em 0.25em 0; background:transparent url(http://cdn.iconfinder.net/data/icons/basicset/pencil_16.png) no-repeat scroll 0 0; float:left; }
    a { padding-left:24px; }
    </style>
</head>
<body>
<div>
    <ul>
        <li><a href="/">Amazon</a></li>
        <li><a href="/">Barnes &amp; Noble</a></li>
        <li><a href="/">Books-A-Million</a></li>
        <li><a href="/">Borders</a></li>
        <li><a href="/">Indie Bound</a></li>
        <li><a href="/">Powell's</a></li>
    </ul>
</div>
</body>

This looks fine and dandy in most modern browsers, but in IE 6 and 7, the "Books-A-Million" link wraps.

I'd like to have the list items variable width and wrapping to new lines, but the links inside not wrapping. I can't figure out the magic combination of display types and CSS browser hacks to make it work. Has anyone tackled this issue before?

A: 

Add white-space: nowrap; to the a tags

Scott
Thanks for the reply. I tried this, but even though the Books-A-Million link is now forced to the next line, the Indie Bound link loses its padding and appears over the background icon now.
dmrnj
Add `display: inline-block;` or some other `hasLayout` trigger to the `a` tag (assuming that does not mess up anything else). If that causes issues in other browsers (I don't think it will), feed your IE a `zoom: 1` instead through your favorite means of targeting IE.
Scott