Support » Fixing WordPress » Problem with tag margins

  • Resolved ggg377


    Hi again!

    I have developed a pretty annoying problem in WordPress. I have set up my posts in a way that categories, tags and the excerpt appear on the same line. Everything would be fine, except the space between the excerpt and the tag is bigger than that between excerpt and category (if a tag is not posted). I would like the space between everything to be 5px. If I lower the tags-links right margin to 1px (like the category one), multiple tags get nudged together. I might be overlooking something simple here, but I don’t see a problem to this solution, because if I set the CSS values of tags and categories to match, the outcome for them is different for some reason (category links never get merged like the tag links do).

    CSS of tags, margins and the excerpt:
    Full CSS:
    an illustration of the problem:
    tags with identical settings to the category CSS:

    Thanks for your help 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • linux4me2


    It looks like you have a bunch of extra whitespace in your code for all those span tags. I would change all those first and re-test.

    On line 41, this:

    <span class="cat-links">
                                    <?php echo $categories_list; ?>

    should be:
    <span class="cat-links"><?php echo $categories_list; ?></span>

    On line 51, this:

    <span class="tags-links">
                                    <?php echo $tags_list; ?>

    should be:
    <span class="tags-links"><?php echo $tags_list; ?></span>

    Then this on line 59 of your code:

    <span class="excerpt-links">
                                    <?php echo $excerptt; ?>

    should be:
    <span class="excerpt-links"><?php echo $excerptt; ?></span>
    without all the extra whitespace.

    Then you can test again and see if there is still an issue.



    Forum Moderator

    takes three parameters, which by default are '' (empty strings).

    in your code you have only set the first parameter ($before), but not the $separator – therefore there is no space character between each tag;

    in the category list, the first parameter is the $separator
    which you have properly set to be a space character.



    Hi again alchymyth!

    I like that you didn’t simply throw the code my way. Had to do some thinking, which fortunately worked out in the end 🙂

    The code I used is: $tags_list = get_the_tag_list( '',' ','' );

    Thanks a lot!

    Linux: I also cleaned up my code. I know, it’s as ugly as sin. I’ll clear it all up when the project is done, but I’ll also attempt to clean up everything I notice in the process.



    Your code isn’t that bad, it’s just easy to miss an extra space in a span tag if you have them as you did. It can make you crazy looking for a solution to spacing problems, so I always fix that first.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Problem with tag margins’ is closed to new replies.