Support » Fixing WordPress » Extra space after the closing </a> tag in wp_list_cats

  • Resolved Ryan Fitzer


    Does anyone know anything about an extra space after the ending </a> in the generated HTML from wp_list_cats. When I apply a background color to box it in, there appears to be more space on the right than on the left. My padding and margins are set to 0. Here’s what I’m using:

    <?php wp_list_cats('sort_column=ID&hide_empty=0&child_of=1'); ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • Are the li’s set to display: inline;? If so, the web browser seems to insert a normal ASCII space after each li. I don’t know how to fix that one.

    I had a bit of trouble which seems similar to yours but I figured it was that the padding was being applied elsewhere. Can I have a link to the site where you’re having the trouble?

    Thanks for getting back to me. Boy, that’s like a needle in a haystack. No wonder it wasn’t happening on site where I floated the li elements. So I’m gonna float from now on! I’ve since reconfigured the links so that that it doesn’t make a difference. But thanks again for that obscure little rule. Here’s some very reliable css that I use for horizontal menus.

    #nav {
    padding:0 7px;

    #nav ul {

    #nav ul li {

    #nav a {
    padding:0 7px 0 7px;

    The last rule lets you create rollovers that fill the li. Here’s the site where I use it

    It looks quite nice to me! Has your question been answered? If so, can you do use a favour by marking this support topic as resolved? Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Extra space after the closing </a> tag in wp_list_cats’ is closed to new replies.