{"id":29081,"date":"2010-03-09T11:00:42","date_gmt":"2010-03-09T16:00:42","guid":{"rendered":"http:\/\/wpmu.org\/?p=29081"},"modified":"2013-05-14T15:44:52","modified_gmt":"2013-05-14T19:44:52","slug":"simple-buddypress-avatar-css-tweaks-rounded-corners-shadows-highlight-admin-moderator","status":"publish","type":"post","link":"https:\/\/wpmudev.com\/blog\/simple-buddypress-avatar-css-tweaks-rounded-corners-shadows-highlight-admin-moderator\/","title":{"rendered":"Simple BuddyPress Avatar CSS Tweaks: Rounded Corners, Shadows, Highlight Admin\/Moderator"},"content":{"rendered":"<p>Here are some quick CSS tips for customizing avatars in your BuddyPress theme. You can file this under the &#8220;cute things you can do with BuddyPress&#8221; category.<\/p>\n<figure id=\"attachment_181563\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-181563 size-full\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2010\/03\/avatars.jpg\" alt=\"BuddyPress avatars.\" width=\"600\" height=\"225\" \/><figcaption class=\"wp-caption-text\">Let&#8217;s customize these BuddyPress avatars.<\/figcaption><\/figure>\n<p>I was inspired by a post in our forums where a user requested a way to distinguish admin\/moderator avatars from general users. You don&#8217;t need to hack the core or write a plugin for it.<\/p>\n<p>Highlighting avatars is simple to do with a little CSS. You will add this to your child theme&#8217;s CSS file.<\/p>\n<h2>How to Highlight Admin Avatars:<\/h2>\n<p>This will add a little white border around all of your avatars site-wide with a light blue border around the admin&#8217;s avatar:<\/p>\n<figure id=\"attachment_181562\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-181562 size-full\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2010\/03\/admin.jpg\" alt=\"BuddyPress avatar with colored border around image.\" width=\"600\" height=\"180\" \/><figcaption class=\"wp-caption-text\">Use CSS to add colored borders to avatars.<\/figcaption><\/figure>\n<pre>{code type=css}\r\nimg.avatar {\r\nbackground: #ffffff;\r\npadding: 4px;\r\nborder: 1px solid #ddd;\r\n}\r\n\r\nimg.avatar.user-1-avatar {\r\nbackground: #ebf7ff;\r\npadding: 4px;\r\nborder: 1px solid #ddd;\r\n}<\/pre>\n<p>Note that the admin&#8217;s user number is 1. If you have other moderators whom you&#8217;d like to highlight as well, you can easily find their numbers by using Firebug to see what class BuddyPress is giving them.<\/p>\n<p>Or you can hover over the username in the Dashboard &gt;&gt; Users list and note the number that follows &#8220;user_id=&#8221; in the status bar at the bottom of your browser. Then simply add multiples like so:<\/p>\n<pre>img.avatar.user-1-avatar, img.avatar.user-5-avatar {\r\nbackground: #ebf7ff;\r\npadding: 4px;\r\nborder: 1px solid #ddd;\r\n}<\/pre>\n<p>The light blue is a slight, unobtrusive distinction for the avatars that match the BuddyPress default theme, but you can change it to any color you like.<\/p>\n<h2>How to Add Rounded Corners to BuddyPress Avatars Site-wide<\/h2>\n<p>If you&#8217;re a fan of rounded corners, this bit of CSS will add it to your avatars site-wide. Please note that this doesn&#8217;t actually round the image but rather the corners on the border and its background.<\/p>\n<pre>img.avatar {\r\nbackground: #ffffff;\r\npadding: 4px;\r\nborder: 1px solid #ddd;\r\n\r\n\/* Round Corners (native in Safari, Firefox and Chrome) *\/\r\n-moz-border-radius: 6px;\r\n-webkit-border-radius: 6px;\r\n}<\/pre>\n<p>This technique does not work in IE (the bane of every developer&#8217;s existence). You&#8217;ll need to use JavaScript to accomplish this if you want it to match in IE.<\/p>\n<figure id=\"attachment_181564\" class=\"wp-caption aligncenter\" data-caption=\"true\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-181564\" src=\"https:\/\/wpmudev.com\/blog\/wp-content\/uploads\/2010\/03\/shadow.jpg\" alt=\"BuddyPress avatar with a shadow around the image border.\" width=\"600\" height=\"180\" \/><figcaption class=\"wp-caption-text\">Use CSS to add a shadow to BuddyPress avatars too!<\/figcaption><\/figure>\n<h2>How to Add a Shadow to BuddyPress Avatars with Rounded Corners<\/h2>\n<p>This is a cute thing you can do to your avatars to make them pop a little more:<\/p>\n<pre>img.avatar {\r\nbackground: #ffffff;\r\npadding: 4px;\r\nborder: 1px solid #ddd;\r\n\r\n\/* Round Corners (native in Safari, Firefox and Chrome) *\/\r\n-moz-border-radius: 6px;\r\n-webkit-border-radius: 6px;\r\n\r\n\/* Add the Shadow *\/\r\n-moz-box-shadow: 2px 2px 2px #dddddd;\r\n-webkit-box-shadow: 2px 2px 2px #dddddd;\r\n}<\/pre>\n<p>I hope this was helpful for those of you who want to add a little bit of customization without having to be a CSS or PHP wizard. Enjoy customizing your theme and let us know if there other tutorials that would be helpful to you. Happy theming! :)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here are some quick CSS tips for customizing avatars in your BuddyPress theme. You can file this under the &#8220;cute things you can do with BuddyPress&#8221; category. I was inspired by a post in our forums where a user requested a way to distinguish admin\/moderator avatars from general users. You don&#8217;t need to hack the [&hellip;]<\/p>\n","protected":false},"author":4099,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"blog_reading_time":"","wds_primary_category":0,"wds_primary_tutorials_categories":0,"footnotes":""},"categories":[1,235,263],"tags":[1044,80],"tutorials_categories":[],"class_list":["post-29081","post","type-post","status-publish","format-standard","hentry","category-news-community","category-misc","category-tutorials","tag-css","tag-avatars"],"_links":{"self":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/29081","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/users\/4099"}],"replies":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/comments?post=29081"}],"version-history":[{"count":4,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/29081\/revisions"}],"predecessor-version":[{"id":181485,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/29081\/revisions\/181485"}],"wp:attachment":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/media?parent=29081"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/categories?post=29081"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tags?post=29081"},{"taxonomy":"tutorials_categories","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tutorials_categories?post=29081"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}