A reader of this blog posted a comment asking me to share the code that I’m using for the comment gravatar images. I’ve provided the code below, but keep in mind that you can always use Firebug to look at the CSS code used on elements of a website. I’m not saying you should copy code from other sites, but you can certainly get ideas and learn from other web developers as to how they achieve certain effects.
It’s really just CSS that was used to achieve the border and drop shadow effect, along with an image I had to create.
Now, you can certainly recreate that shadow effect using only CSS and that’s also an option for you. Here are two links to tutorials on that:
- CSS Drop Shadows Without Images from Nicolas Gallagher.
- Pure CSS3 box-shadow page curl effect from Matt Hamm.
Here’s my simple CSS code that I used for the avatar images on this site. Just add this to your custom.css file.
.custom span.avatar {
background: url(images/shadow.png) no-repeat center bottom;
float: right;
height: 103px;
margin-left: 10px;
width: 86px;
}
.custom .avatar img {
background: #FFFFFF;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
border: 1px solid #DDDDDD;
padding: 5px;
}
Here is a link to the image file I used. If your avatar image on your site is not the same size then the shadow won’t work and you’ll need to create a new one, or you can just try out one of the CSS solutions I provided above. You can always adjust the avatar image size too.
Of course, you aren’t limited to this styling. You can get creative and style the comment gravatar images any way you want with CSS.
Was this post helpful? Consider subscribing to my blog via RSS or




































{ 10 comments… read them below or add one }
Thanks a lot once again mate… I actually used FireBug to have an idea of what you have implemented but I was doing something wrong which I realised now… and now it worked
Cheers!!
Amandeep Singh recently posted..Top 5 Android Facebook Apps for 2012
Very nice and easy to implement, thanks for sharing this easy custom styling.
How would you do the same for the top? I want to add it to the top and bottom as well. I will flip the image for the top piece.
George Serradinho recently posted..SEO And/Or PPC – What will it be?
You could create a single image with both a top and bottom shadow and the use that as the background image. You may need to adjust some of the values in the css, like perhaps the height of the avatar span.
Another way would be to use multiple backgrounds with css, although most version of IE don’t support that.
Sir i need your help i just stylified my blog but it needs customization the shadow below the avatar is creating problems and the text “{ 3 comments… read them below or add one }” is appearing black in my site and unable to view easily! Please help or just come to live chat with me please
Your site sure looks familiar. I see you copied some design elements from this site. As to the avatars, you need to increase the size of the avatar so the shadow image fits. Also with regard to the comments intro section, just change the color of the anchor tags to white in the css file.
I am seeking your help just because i cannot do exactly and cannot find the relative css codes! Can you please guide me
I don’t use thesis but thanks for the code and the image.
Tu Nguyen recently posted..Consistency Is The Key To Your Blogging Success
I have added it seems to adjust some margins and paddings to make it work perfectly
Ammar Ali recently posted..Top 3 Theme Frameworks For WordPress
Great! Thanks for sharing this! I’ll try it… Hehehe
Katie recently posted..Family Lawyer
Nice tips.
Sovo recently posted..Earn Money from your blog or website very easily (especially for those who do not have a Google AdSense)