• Resolved slobizman

    (@slobizman)


    I could use some help on getting a gravatar into the right spot in my comments; I’m not much of a CSS person.

    I am using the Whitespace theme. It didn’t come with avatar support, and I am trying to add it somewhere that makes sense in the comments. I am trying to place at the top left within the comment text display box (#commenttext) and wrap the comment text around it.

    Here is the avatar class I made:

    #commenttext .avatar
    {
    float:left;
    padding:2px;
    margin:0 0 0.5em 0.5em;
    background:none;
    border: none;
    }

    Here is the comments.php snippet. I’ve added the bolded code:

    <div class="commenttext">
    <strong><span class="avatar">
    <?php if(function_exists('get_avatar')){
      echo get_avatar($comment, '50');
    } ?>
    <span></strong>
    <?php comment_text() ?>
    </div>

    I used SPAN, but also tried DIV.

    The problem is that the comment text area shows the image at the top left, but then the comment text begins below the image, not wrapping around it.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    1. You should use a div around the image instead of a span, because a div implies that it’s a block instead of inline. And you can only float blocks. Also, you should not wrap it in strong tags. It’s an image, strong has no meaning around it.

    2. Your code says class="commenttext" but then you reference it like an id (using # instead of . as the prefix). Which is it?

    In other words, you should be using .commenttext .avatar with that HTML.

    3. It really is more helpful to simply provide people with a link to the actual site. They don’t need to see code snippets to help with CSS problems, CSS issues can only be really solved by looking at a real live site having the problem.

    Thread Starter slobizman

    (@slobizman)

    As soon as you mentioned the ID versus the Class it, I found my mistake right away. Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Could really use help from a CSS person with getting a gravatar in my comments’ is closed to new replies.