Related Posts Widget with Thumbnails and Summary for Blogger

Posted by Unknown

There are several tutorials quite old which have explained different methods for displaying related posts in Blogger [1] [2] but in this tutorial, I will show you how to implement a very beautiful Related Posts widget that comes along with Thumbnails and Posts Snippets, as well. If you want to add it, follow the next steps below:

How to Add Related Posts Widget with Summary to Blogger

Step 1. From your Blogger Dashboard, go to Template and click on Edit HTML


Step 2. Tick the "Expand Widget Templates" checkbox:
 Step 3. Find (CTRL + F) this tag:

</head>

...and paste the following code just above it:
<script type='text/javascript'>
//<![CDATA[
var relatedTitles = new Array();
var relatedUrls = new Array();
var relatedpSummary = new Array();
var relatedThumb = new Array();
var relatedTitlesNum = 0;

var relatedPostsNum = 4; // number of entries to be shown
var relatedmaxnum = 75; // the number of characters of summary
var relatednoimage = "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjS3y6gMMMSou1ENPmRmmk4uSlQNtAvGvI40nxafZ7id6Ku_ezNuMOiaCv_0w6rA_rE2MC1u4soFJbl4vq6LltUfjUgfDXOIqsC19mm4bX4wb_BNIUbHlivkHWw71cY7hMsXVoSEhm_OhmX/s1600/no_image.jpg"; // default picture for entries with no image

function readpostlabels(json) {
  var entry, postimg, postcontent, cat;
  for (var i = 0; i < json.feed.entry.length; i++) {
    entry = json.feed.entry[i];
    if (i==json.feed.entry.length) { break; }
    relatedTitles[relatedTitlesNum] = entry.title.$t;
    postcontent = "";
    if ("content" in entry) {
      postcontent = entry.content.$t;
    } else if ("summary" in entry) {
      postcontent = entry.summary.$t;
    }
    relatedpSummary[relatedTitlesNum] = removetags(postcontent,relatedmaxnum);
    if ("media$thumbnail" in entry) {
      postimg = entry.media$thumbnail.url;
    } else {
      postimg = relatednoimage;
    }
    relatedThumb[relatedTitlesNum] = postimg;
    for (var k = 0; k < entry.link.length; k++) {
      if (entry.link[k].rel == 'alternate') {
        relatedUrls[relatedTitlesNum] = entry.link[k].href;
        break;
      }
    }
    relatedTitlesNum++;
  }
}
function showrelated() {
  var tmp = new Array(0);
  var tmp2 = new Array(0);
  var tmp3 = new Array(0);
  var tmp4 = new Array(0);
  for(var i = 0; i < relatedUrls.length; i++) {
    if(!contains(tmp, relatedUrls[i])) {
      tmp.length += 1; tmp[tmp.length - 1] = relatedUrls[i];
      tmp2.length += 1; tmp2[tmp2.length - 1] = relatedTitles[i];
      tmp3.length += 1; tmp3[tmp3.length - 1] = relatedpSummary[i];
      tmp4.length += 1; tmp4[tmp4.length - 1] = relatedThumb[i];
    }
  }
  relatedTitles = tmp2; relatedUrls = tmp; relatedpSummary = tmp3; relatedThumb = tmp4;
  for(var i = 0; i < relatedTitles.length; i++){
    var index = Math.floor((relatedTitles.length - 1) * Math.random());
    var tempTitle = relatedTitles[i]; var tempUrls = relatedUrls[i];
    var tempResum = relatedpSummary[i]; var tempImage = relatedThumb[i];
    relatedTitles[i] = relatedTitles[index]; relatedUrls[i] = relatedUrls[index];
    relatedpSummary[i] = relatedpSummary[index]; relatedThumb[i] = relatedThumb[index];
    relatedTitles[index] = tempTitle; relatedUrls[index] = tempUrls;
    relatedpSummary[index] = tempResum; relatedThumb[index] = tempImage;
  }
  var somePosts = 0;
  var r = Math.floor((relatedTitles.length - 1) * Math.random());
  var relsump = r;
  var output;
  var dirURL = document.URL;

  while (somePosts < relatedPostsNum) {
    if (relatedUrls[r] != dirURL) {

      output = "<div class='relatedsumposts'>";
      output += "<a href='" + relatedUrls[r] + "' rel='nofollow'  target='_self' title='" + relatedTitles[r] + "'><img src='" + relatedThumb[r] + "' /></a>";
      output += "<h6><a href='" + relatedUrls[r] + "' target='_self'>" + relatedTitles[r] + "</a></h6>";
      output += "<p>" + relatedpSummary[r] + " ... </p>";
      output += "</div>";
      document.write(output);
     
      somePosts++;
      if (somePosts == relatedPostsNum) { break; }
    }
    if (r < relatedTitles.length - 1) {

      r++;
    } else {
     
      r = 0;
    }

    if(r==relsump) { break; }
  }
}
function removetags(text,length){
  var pSummary = text.split("<");
  for(var i=0;i<pSummary.length;i++){
    if(pSummary[i].indexOf(">")!=-1){
      pSummary[i] = pSummary[i].substring(pSummary[i].indexOf(">")+1,pSummary[i].length);
    }
  }
  pSummary = pSummary.join("");
  pSummary = pSummary.substring(0,length-1);
  return pSummary;
}
function contains(a, e) {
  for(var j = 0; j < a.length; j++) if (a[j]==e) return true;
  return false;
}
//]]>
</script>
Note:  
  • To change the number of posts that are being displayed, modify the value in red (4)
  • To change the number of characters to be shown in posts summary, modify the value in green (75)
  • To change the default pic for posts with no images, add your URL instead of the one marked in blue

... also paste the code below just above the </head> tag:
<style>
.relatedsumposts {
  float: left;
  margin: 0px 5px;
  overflow: hidden;
  text-align: center;
  /* width and height of the related posts area */
  width: 120px;
  height: 210px;
}

.relatedsumposts:hover {
background-color: #F3F3F3; -webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
}

.relatedsumposts img:hover {
-khtml-opacity:0.4;
-moz-opacity:0.4;
opacity:0.4;
}

.relatedsumposts a {
  /* link properties */
color: #linkcolor;
  display: inline;
  font-size: 10px;
  line-height: 1;
}
.relatedsumposts img {
  /* thumbnail properties */
margin-top: 2px;
  height: 82px;
  padding: 5px;
  width: 82px;
border: 1px solid #fff;
-webkit-border-radius: 100px;
-moz-border-radius: 100px;
border-radius: 100px;
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .4);
-moz-box-shadow: 0 1px 2px rgba(0, 0, 0, .4);
box-shadow: 0 1px 2px rgba(0, 0, 0, .4);
}
.relatedsumposts h6 {
  /* title properties */
  display: table-cell;
  height: 5em;
  margin: 5px 0 0;
  overflow: hidden;
  padding-bottom: 2px;
  vertical-align: middle;
  width: 130px;
}

.relatedsumposts p {
  /* summary properties */
border-top: 1px dotted #777777;
border-bottom: 1px dotted #777777;
color: #summarycolor;
  font-size: 10px;
  height: 4em;
  line-height: 1;
  margin: 5px 0 0;
  overflow: hidden;
  padding: 5px 0 15px 0;
  text-align: left;
}
</style>
Note:  
  • Modify the values in red to adjust the width (120) and height (210) of the widget area
  • Replace #linkcolor with the hex value of your color to change the color of post titles
  • To change the size of thumbnails, modify the values marked in violet (82)
  • To determine the border roundness, modify the values in orange (100)
  • To change the color of the post snippet, change #summarycolor with color hex value

Step 4. Search (CTRL + F) for the following fragment:

<a expr:href='data:label.url' rel='tag'><data:label.name/></a><b:if cond='data:label.isLast != &quot;true&quot;'>,</b:if>

... and add this code just below it:

<b:if cond='data:blog.pageType == &quot;item&quot;'>
    <script expr:src='&quot;/feeds/posts/default/-/&quot; + data:label.name + &quot;?alt=json-in-script&amp;callback=readpostlabels&amp;max-results=50&quot;' type='text/javascript'/>
  </b:if>

The entire fragment should look like this:

          <b:loop values='data:post.labels' var='label'>
            <a expr:href='data:label.url' rel='tag'><data:label.name/></a><b:if cond='data:label.isLast != &quot;true&quot;'>,</b:if>
<b:if cond='data:blog.pageType == &quot;item&quot;'>
    <script expr:src='&quot;/feeds/posts/default/-/&quot; + data:label.name + &quot;?alt=json-in-script&amp;callback=readpostlabels&amp;max-results=50&quot;' type='text/javascript'/>
  </b:if>

          </b:loop>

Step 5. Find this fragment of code:

</b:includable>
<b:includable id='postQuickEdit' var='post'>

Note: if you can't find it, then search only for the code in red

! Click on the sideways arrow to expand the code, then scroll down until you reach to the highlighted line !

...add just ABOVE it, add the following:

<b:if cond='data:blog.pageType == &quot;item&quot;'>
  <div class='post-footer-line post-footer-line-4'>
    <div id='relatedpostssum'><div style='text-align: left; font-size: 15px; margin-bottom: 10px; font-weight: bold;'>RELATED POSTS</div>
      <script type='text/javascript'>showrelated();</script>
    </div>
    <div style='clear:both;'/>
  </div>
</b:if>
Screenshot

Step 6. Save your Template... and hopefully we're done...

Enjoy!
More aboutRelated Posts Widget with Thumbnails and Summary for Blogger

CSS Basics. How to Apply Rounded Corners On Images #2

Posted by Unknown

blogger tricks, css tricks, border radiusIn the previous post I have mentioned that we will learn to round images using CSS, without needing to edit them one by one using a program. Now that we have seen the basics of CSS, let's try to apply to some images.

What we will do is to upload an image as normal (HTML) and then add some rules in our style sheet that will transform the outer shape as a circle... or at least to appear round. This will depend on the proportions of image that we use.

In fact, we can apply this effect to any image, to all of an area or to all in our blog. That depends on your tastes.

Marking up HTML

Obviously the first thing we need for in order to round an image is an idem. The code could be more complicated, but an image is built within the img tag and basically looks like this:

<img src="image_URL"/>

Screenshot:




This is how we make it look something like the one from the left. Normally, it should also keep an alt text and sometimes it carries some forced dimensions (with width and/or height). When you upload an image, the code inside the Blogger editor also contains a link that is pointing to the original image.

But if we want to modify this image using CSS, we need to incorporate a class selector. We can add it in two ways: within the img tag or to a parent box. The name that I have chosen for the selector is roundedcorners:

<img class="roundedcorners" src="image_URL"/>


<div class="roundedcorners">
<img src="image_URL"/>
</div>


Applying style to all homogeneous elements

But that selector alone will do nothing. It needs to be linked to a style rule that tells what to do with it. As much as we add classes, if these are not defined in the CSS, the appearance of the image (or a certain element) will not change.

To change the shape of all the images on our blog, this would be what we should add to our CSS:

img {
border: 2px solid #BADA55;
margin: 0;
padding: 0;
border-radius: 900px;
-moz-border-radius: 900px;
}

And how it translates to your browser? As follows:

Search for images by name tag (img) and apply the following style:
  • a solid green border of 2 pixels
  • margins (space outside the border) and padding (space inside the border) is set to zero
  • the image is round at the four corners

Now that we have this rule in our style sheet itself, we can see the picture as we wanted - see the example on the right.

To declare a property correctly, we need to know what it does and how to write and you can find more info in many places, although W3C is the authority in this.

For example border-radius requires initially 4 values reading from left to right that represent the roundness of the upper-left, upper-right, lower-right and lower-left corner. If you put a single value is understood that all four will be equal to that.

You should also know that when the value of the border exceeds the dimensions of the box, this border is adapted to form a circle.

How to Apply Style to the Elements of the Same Block

But surely we do not want all the blog images to be round, but only those that we choose, otherwise adding the above style in the head tag will make all of our blog images to take this shape. Before we used an HTML tag (img) and not a selector and that is why the style will affect all images.

To avoid this, we can do one of the things we saw at the beginning and that was to put the image inside a div with the roundedcorners class. In this way, only the images that are in a box with that class will be affected by the rule that will make them round.

<div class="roundedcorners"><img src="image_URL"/></div>

But the rule then should not attack the img tag directly, but the roundedcorners selector. In this case, you should write it like this:

.roundedcorners img {
border: 2px solid #BADA55;
....
}

This means that this style applies only to images that are in a box with roundedcorners class.

Epilogue

To close the subtopic of rounding images, you have to keep in mind that if these are not square, instead of becoming circular, they will look oval.


To fix this we should add the width and height with the same measure (value in pixels), that is to force the image cropping and to make it appear perfectly circular. That was all!

If you enjoy reading this blog, please share and subscribe. For any questions, drop a comment below ;)

More aboutCSS Basics. How to Apply Rounded Corners On Images #2

CSS Basics. How to Apply Rounded Corners On Images #1

Posted by Unknown

This tutorial will explain how to change the outside border of any image using some simple CSS rules to make it round, but this is so easy to do, that I'm finally going to make this entry for other purposes.
rounded corners, css tricks, blogger tricks, blogger design
The trick today that I'm going to publish in two parts is to help to understand at least a little of what CSS (Cascading Style Sheets) is. But very briefly that I'm not able to do a good comprehensive manual on the subject. For those who want to see a bit more, take a look at this link and for those who really want to learn thoroughly, I recommend to visit this site.

Introduction and terminology

Style sheets aim to help sort out what is the structure of a website and which is its format, its appearance. Thus, the CSS box model is essentially a box that wraps around HTML elements, and it dictates how those boxes are presented in terms of colors, fonts, width, backgrounds etc.

The advantage is that if in the future we decide to change something, we don't have to change all the pages one by one, but simply change the properties of one kind or another box from the style sheet and these changes will automatically apply in all the pages.

The style sheet is a set of rules, in turn composed of selectors and declarations. The selector is to be used as a nickname or name of what you want to configure from the sheet and apply to the HTML and declarations are properties that are assigned to the desired values ​​(more information on CSS syntax)

Adding the CSS selector

Once we put for example the one above in our style sheet, we see that in our website... nothing happens. I said that the selector is what relates HTML and CSS so that if we want a box to take these values ​​for width, background color, border and font size (that's what we defined earlier), we need to include the selector, thus:

<div class="SelectorName">Text here</div>

What we have added is a rule that tells the browser to interpret that this box has to be of a certain type or class. A class that was mentioned earlier is called selector having some specific properties and values ​​defined in the style sheet.

Now we'll see how this will change the look of the box, while all others that don't have the SelectorName  name will follow the standard appearance.

Therefore, when we include a rule in a style sheet, or modify an existing one, what happens is that all boxes marked with that selector will change their appearance according to the properties-values ​​that we have defined.

On the contrary, if we want that an unmarked box to change its appearance with the CSS rules defined, we'll add the appropriate selector.

Where to add the CSS style

The style can be put in a CSS file. The file is created with all the rules, you get the address and then include the following line in the header of your template. For Blogger, you can add it between <head> and <b:skin><![CDATA[/*:

<link href="syle.css" rel="stylesheet" type="text/css"/>

Note: in blue is where the address of your CSS file should be added.

You can also add the style directly mixed with HTML, inserted between the style tags:

<style>
.SelectorName {
background-color: #EAEAEA;
border: 1px solid #444444;
width: 200px;
font-size: 12px;
}
</style>

It can be inserted into a particular box, as well. In this case, you do not need to add any selector to indicate where the CSS style is:

<div style="background-color: #EAEAEA; border: 1px solid #444444; width: 200px; font-size: 12px;">Text here</div>

In Blogger the rules are between the skin tags, which means they are between <b:skin><![CDATA[/* and ]]></b:skin>. If you edit the template, will find that there are many things in between. All this is CSS that marks the appearance of your blog.

In case we want to see the effect after changing the value of some propriety, we can click on the Preview button. We can also remove anytime a declaration or add another to the desired selector.

For those who don't want to touch the template, you can add the CSS directly by going to the Advanced section > Add CSS of your Template Designer.


That's enough for today. The next tutorial will discuss in more detail about how to add rounded corners to our images using CSS.
More aboutCSS Basics. How to Apply Rounded Corners On Images #1

10 Places to put Adsense ads in Blogger

Posted by Unknown

This article will discuss about the more common 10 places on our blog where we can place ads and about how to implement them and also which are the most suitable formats based on those available in our AdSense account.

Advertisements

In the Sidebar

adsense, ads, add adsense blogger

How to implement.

This is one of the easiest places to place AdSense. Just go to the page elements (layout), click on the "Add a Gadget" link and add an HTML/Javascript widget with your ad code inside it or add directly an AdSense widget.

Recommended formats: 125 × 125, 120 × 600 and 160 × 600

Between posts

blogger posts, blogger tricks, adsense ads

Implementation. You can implement AdSense ads between your posts: go to Layout, click on the "Edit" link below the Blog Posts section, then check the "Show Ads Between Posts" option.

Recommended formats: 468 × 60, 300 × 250 and 336 × 280

Under the header

blogger header, blogger tips, adsense

Implementation:

Firstly, convert your AdSense ad code. You can use this converter here:
AdSense Ad Converter

Then, go to your Blogger Template (from your Dashboard, click on Template and press the Edit HTML button) and search for:

<div id='header-wrapper'>

Then paste the converted code right after it.

Recommended formats: 728 × 90 and 728 × 15

Above the blog posts


make money, adsense, blogger tutorials

Implementation:

Convert your ad code and search for <div id='main-wrapper'> in your template.

Paste the converted code right after it.

Recommended formats: 460 × 68, 468 × 15 and 336 × 280

Under the title of the post (this will be visible on all the pages)

money online, blogger tricks, how to blogger
 Implementation:

Convert your AdSense ad code and then go to your Template, Expand Widget Templates and look for:

<div class='post-header-line-1'/>

Note: if you can't find it, search it without the ending slash /

Paste the converted code right after it.

Recommended formats: 468 × 68 and 468 × 15

Under the post title (visible only on the posts pages)

Implementation:

Convert your ad code and then go to your Template, Expand Widget Templates and look for:

<div class='post-header-line-1'/>

Note: if you can't find it, search it without the trailing slash /

Paste the converted code, following this example:

<b:if cond='data:blog.pageType == "item"'>

<!-- Here your ad code -->

</b:if>

Recommended formats: 468x68 and 468x15

In the posts' footer

post footer, adsense, blogger blogspot

Implementation:

Convert your ad code and then go to your Template, Expand Widget Templates and look for:

<p class='post-footer-line post-footer-line-3'/>

Note: if you can't find it, search it without the trailing slash /

Paste the converted code right after this line.

Recommended formats: 468x68 and 468x15

In the post's body (it will be visible on all pages)

adsense how to, blogger tricks, gadgets

Implementation:

Convert your ad code and then go to your Template, Expand Widget Templates and look for:
<div class='post-body entry-content'>

Note: in case you don't fint this code, search only for <div class='post-body'>

And paste the converted code, following this example:

<div style='float:right'>

<!-- Here ad code -->

</div>

Recommended formats: 125x125, 180x150, 120x240 and 200x200

In the post's body (visible only in post pages)

Convert your ad code and then go to your Template, Expand Widget Templates and look for:

<div class='post-body entry-content'>

Note: in case you don't fint this code, search only for <div class='post-body'> 

And paste the converted code, following this example:

<b:if cond='data:blog.pageType == "item"'>
<div style='float:right'>

<!-- Here your ad code -->

</div>
</b:if>

Recommended formats: 125x125, 180x150, 120x240 and 200x200

Between post and comments (visible only on posts pages)


Implementation:

Convert your ad code and then go to your Template, Expand Widget Templates and look for:

</b:includable>
<b:includable id='commentDeleteIcon' var='comment'>

Paste the converted code just above it, following this example:

<b:if cond='data:blog.pageType == "item"'>

<!-- Here comes your ad code -->

</b:if>

Recommended formats: 468x60, 300x250 and 336x280

In the blog's footer

blogger footer, adsense ads, make money online

Implementation:

Convert your ad code and then go to your Template, Expand Widget Templates and look for:

<div id='footer-wrapper'>

Paste the converted code right after it.

Recommended formats: 728x90 and 728x15

FAQ

I anticipated some questions likely to arise:

I can't find the codes, what should I do?
Always check the "Expand Widget Templates" checkbox. These are the default codes of Blogger and should be found in all the templates unless they have been changed by a hack or the template designer.

Why should I convert my AdSense code?
The Blogger's Template reads it as text and not as code and it is good to avoid any errors when trying to save it.

The ads are not displaying properly, why is that?
The ads could be affected by the styles (CSS) selectors (divs) containing them and some templates could be wrong designed, then you should consider modifying these styles, look for another relevant place or in extreme cases, change the template.

Can I put the all 10 codes on my blog?
No, you should choose just one of the places where you want to put the ads considering that AdSense have some limits on the number of ads that could be displayed. Try to make a balance with your content.

Why we there should be only 3 ads displayed on the main page?
Is due to the limit set by the AdSense. Combine the type of ads (text, rich media ads and link units) to be able to show the number of ads you want.

Hopefully, this will be useful to those of you wanting to display AdSense ads on your blog.
More about10 Places to put Adsense ads in Blogger

Recent Comments Widget with Hide Author Comments function For Blogger

Posted by Unknown

A few days ago, Mrpolie asked if there's a way to hide the author comments in the Recent Comments widget so that we would be able to see only readers' comments and our replies to be hidden. So, in this post I'll be sharing with you the Recent Comments widget that comes with this function. If you want to show just blog readers' comments rather than yours, you have just to change "Blogger User" text with the surname under which you are posting.

recent comments widget, recent comments, blogger

The main features of this recent comments widget:
  • You'll be able to hide your comments
  • Change the avatar size
  • Set the number of comments to display
  • Set the length of comment for the widget to display

Now let's start adding it...

Step 1. From your Blogger Dashboard, go to Layout and click on Add a Gadget link


Step 2. In the pop-up window, choose the HTML/JavaScript widget


Step 3. Copy-paste the following code:

Recent Comments Widget with Round Avatars: 

Click to see the code

Recent Comments Widget With Post Titles (no avatars): 

Click to see the code

Some changes before saving it.

- to set the number of comments to be shown, change the "5" value from the orange line
- for the number of characters, change the "67" (for the 2nd widget, it is 95) value from the green line
- to hide your comments, replace the Blogger User text TWICE with your name
- to change the size of avatar, change "50" from the blue line.
- if you don't want rounded avatars, delete this line:

-webkit-border-radius: 100px;-moz-border-radius: 100px;border-radius: 100px;

Step 4. Save your widget. You're done.
More aboutRecent Comments Widget with Hide Author Comments function For Blogger

Add a Different Background For Author Comments in Blogger's Threaded Comments

Posted by Unknown

In this tutorial we will learn how to highlight the author comments so that they will have a different background color, border, or anything that makes them stand out from the others. To achieve this, we need to add a code in the Blogger's template and to modify the style according to our preferences.
blogger tricks, blogger comments
  

How to highlight author comments in Blogger:

Step 1. Go to Template, click on Edit HTML

blogger threaded comments, customize blogger comments

Step 2. Click anywhere inside the code area and try to find - using CTRL + F keys - this tag:
</body>
Screenshot:
blogger comments, blogger tricks

Step 3. Just above it, paste the following code:
<script src='http://code.jquery.com/jquery-latest.js'/>
<script>
$(function() {
function highlight(){
$('.user.blog-author').closest('.comment-block')
.css('border', '1px solid #FFA500')
.css('background','#F1F1F2 url("http://www.blogblog.com/1kt/transparent/white80.png")')
.css('color', '#444444')
.css('font-size', '12px')
.css('padding', '10px');
}
$(document).bind('ready scroll click', highlight);
});
</script>

Customizing the Author Comments:


Border:
The line marked in orange represents the border's style.
What it can be done:
  • 1px - you can increase the value to change the border's thickness
  • solid - change the border's style to dotted, dashed, inset, outset etc.
  • #FFA500 - this is the border's color value, change it with your own color

Background:
The line marked in blue represents the background's style. You can use a plain color or an image. By default there's a combination of both (a white transparent image with a gray plain color).
To change/add:
  • a different color: replace the #F1F1F2 value with your own (use this tool to find the hex code of your desired color)
  • an image: replace the defaul url http://www.blogblog.com/1kt/transparent/white80.png with that of your image

Font Color:
To change the font's color, replace the #444444 color value in green with your own. (you can use this tool to find the hex code of your desired color)

Font Size:
Modify the value in red by increasing/decreasing the "12" value in order to change the size of text.

Step 4. Now Save your Template.

To customize the entire style of threaded comments, please check my previous tutorial on How to Customize Comment's Background, Font Color and Border in Blogger.
More aboutAdd a Different Background For Author Comments in Blogger's Threaded Comments

How to Customize Blogger Comments By Adding a Background Color and Border

Posted by Unknown

The comments are an essential part of a blog because in them is reflected the readers' opinions regarding a post or our blog, so it is important to spend a little of our time to make this part looking more presentable, accessible and neat.

To set in order our comments, it is necessary to make each comment easy to identify, therefore to know from where it begins and to where it ends, otherwise it becomes a jumble of letters of which the reader can run away. Here are some ways to make some order by separating each comment.

- Add a Separator To Blogger Comments
- Add a Divider Below Comments in Blogger
- Fully Customize Your Blogger Comments By Changing The Background Color and Border

The first method is the easiest, and is about how to put a border below our comments, this is to separate each blog comment in a simple but effective way.

How to Add a Separator/Border To Blogger Comments

customize comments, blogger

Step 1. To add a simple separator go to Template > Edit HTML and click on the small arrow on the left of <b:skin>...</b:skin>
Step 2. Click anywhere inside the code area and search using CTRL + F keys, for the following piece of code:
]]></b:skin>

Step 3. Paste the following style just above it:

- If we are using threaded comments (with the reply option):

.comment-block {
border-bottom: 1px solid #000000;
}

.comments .continue {
  border-top: 0px solid $(widget.alternate.text.color);
}

- If we are using previous commenting system (with no reply option)

#comments-block .comment-footer {
border-bottom:1px solid #000000;
}

Note: To change the border's color, replace the bolded color value and to change its thickness, increase/decrease the 1 value.

Step 4. Save the Template.

Instead of a simple border, we can also add a divider/image between our comments.

How to Add a Divider (Image) Between Each Comment in Blogger

blogger comments, blogger tricks, blogger tutorials

Step 1. Go to Template > Edit HTML and search (CTRL + F) for the following piece of code:
]]></b:skin>
Screenshot:


Step 2. Paste the following just above it:

- If we are using threaded comments (with the reply option):
.comment-block {
background-image:url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgl82MD9SMJGmv_w6nwnGgdsdWkQmLQPoIztfqh7prxZnjL6zdr8qJpWuVE1pYdgxL5-kDvk_t9RaCMCHSKBBuKTZD6ufBiLNcKrwLGeJgb4gGn0vmknGKa_Pth9D169Wm5K5Zxlmf0180_/s1600/74.gif);
background-repeat:no-repeat;
background-position:center bottom;
padding-bottom:30px;
margin-top: -10px;
}

.comments .continue {
border-top: 0px solid $(widget.alternate.text.color);
}

- If we are using previous commenting system (with no reply function)
#comments-block .comment-footer {
background-image:url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgl82MD9SMJGmv_w6nwnGgdsdWkQmLQPoIztfqh7prxZnjL6zdr8qJpWuVE1pYdgxL5-kDvk_t9RaCMCHSKBBuKTZD6ufBiLNcKrwLGeJgb4gGn0vmknGKa_Pth9D169Wm5K5Zxlmf0180_/s1600/74.gif);
background-repeat:no-repeat;
background-position:center bottom;
height: 50px;
}

Note: The URL that is in blue represents the image that you can change as you like, just remember that at the height must set the height of an image with 30px more, for instance, if the image's height is 50px then the value will be 80px. This is for making sure that the image won't overlap the date of comments. (for threaded comments, increase/decrease the padding 30 value)

Step 3. Save the Template.

But you can still have more styles for each comment, for example adding a background color and a border.

How to Add A Border and A Background Color To Blogger Comments

blogger tips, blogger tricks, gadgets
Step 1. Go to Template > Edit HTML and search for the following piece of code:
]]></b:skin>

Step 2. Paste the following just above it:

- If we are using threaded comments (with the reply option):
.comment-block {
background:#F9F9F9; /* Background Color */
border: 1px solid #f1f1f1; /* Border style */
margin-bottom:20px;
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .4);
-moz-box-shadow: 0 1px 2px rgba(0, 0, 0, .4);
box-shadow: 0 1px 2px rgba(0, 0, 0, .4);
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
}

.comments .comment-thread.inline-thread {
background-color: #FAFAFA; /* Background color behind the replies */
border-left: 4px dotted #E6E6E6; /* Border on the left side of replies */
}

.comment-content {
padding:2px 10px 10px 10px;
color:#444444; /* Font Color in Comments */
}

.datetime a {
font-style:italic;
font-size:9px;
margin-left: 2px;
}

.comments .comments-content .user a{
color:#1982D1; /* Author's name color */
font-size: 12px; /* Author's name size */
padding-left: 10px;
font-weight:bold;
text-decoration:none;
}

.comments .comment .comment-actions a,.comments .comment .continue a{
display:inline-block;
margin:0 0 10px 10px;
padding:0 15px;
color:#B4B4B7;
text-align:center;
text-decoration:none;
background:#F8F8FB;
border:1px solid #C2C2C5;
border-radius:4px;
height:20px;
line-height:20px;
font-weight:normal;
cursor:pointer;
}

.comments .continue {
border-top: 0px solid $(widget.alternate.text.color);
}

.comments .comments-content .icon.blog-author {
background-image: none;
margin-left: -10px;
}

.comments .avatar-image-container{
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
width: 40px;
max-height: 40px;
border: 1px solid #F2F2F2;
padding: 1px;
}

.comments .avatar-image-container img{
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
max-width: 40px;
height: 40px;
}

Step 3. Save the Template.

- If we are using previous commenting system (with no reply function):

Step 1. Search for this line in your template:
<b:loop values='data:post.comments' var='comment'>

Step 2. Then, add the following code just below of it:
<div class='comments-ct'>

Step 3. Look a little further down and you'll see the </b:loop> code and just above it, add this:
</div>

Step 4. Now find this:
]]></b:skin>

Step 5. And just above of it, add this CSS code:
.comments-ct{
background:#F9F9F9; /* Background Color */
border: 1px solid #f1f1f1; /* Bprder Style */
margin-bottom:20px;
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .4);
-moz-box-shadow: 0 1px 2px rgba(0, 0, 0, .4);
box-shadow: 0 1px 2px rgba(0, 0, 0, .4);
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
}

.comment-body {
color:#444444; /* Font Color in Comments */
padding:10px;
}

.comments-ct a {
padding-left: 5px; /* Link color */
color: #4A9BD8;
}

.comment-timestamp a {
font-style:italic;
font-size:9px;
padding-right:10px;
padding-left:10px;
}
(The rounded edges will not work in Internet Explorer with CSS)

In either case, you can change the background color, border, etc.. in parts with annotations in green.

Step 6. Save the Template.

If you need more help, leave a comment below.
More aboutHow to Customize Blogger Comments By Adding a Background Color and Border