How to Display Round Gravatar Images in WordPress

Recently, we showed you how to style your comments layout and how to style your comment form. One of our users emailed us and asked β€œhow did you make your gravatar images round? Are you storing gravatar images locally to get them to be round?” In this article, we will show you how to display round gravatar images in WordPress. We will use the border-radius property of CSS3 to create circular gravatar images.

First thing you need to do is edit your theme’s style.css file. You can do this by using a FTP program or by going to Appearance Β» Editor in your WordPress admin. Next, you want to add the following code in your CSS file:

1
2
3
4
5
.avatar {
border-radius: 50%;
-moz-border-radius: 50%;
-webkit-border-radius: 50%;
}

This should work on most WordPress themes. However, if this does not work on your theme, then there is probably some plugin or your theme function messing with the default classes used for gravatar in WordPress. In order to find out which css class gravatar images are using in your theme, you need to open a blog post that has comments. Scroll down to the comments section, and right click on the gravatar image to select Inspect Element. It will show you the source code for your gravatar, like this:

If the gravatar image has something other than avatar then use that instead of .avatar in the above css code.

We hope that this article helped you display round gravatar images on your WordPress blog. Let us know if you have any questions or feedback by leaving a comment below.

Leave a Reply

Your email address will not be published. Required fields are marked *

error: Content is protected !!

Pin It on Pinterest

Add address