Showing posts with label CSS in Blogger. Show all posts
Showing posts with label CSS in Blogger. Show all posts

Friday, 15 August 2014

Blogger Post Image Borders Change or Remove





Sometimes you may want to remove, delete or change the image border of a custom Blogger template or default Blogger template (Blogspot template). In this Blogger tutorial you will learn how easy it is to make changes to your template so that you can get rid of unwanted image borders around all the images that appear in your blog posts or around a single image in a blog post.

You will also learn how to enhance your Blogger template (Blogspot template) by changing the line color and line style of the existing image borders.
Note this Blogger tutorial applies to custom templates and the previous generation of Blogger templates. If you are using the new default Blogger Template Simple please refer to my Blogger tutorial How to Remove the Image Border in Blogger template Simple for instructions

This Blogspot tutorial is rated easy. It involves making minor alterations to your Blogger template (Blogspot template) but this is well within the capabilities of beginner bloggers and newbies. The changes will take less than 5 minutes to complete and can make the world of difference to your Blogger template.
Blogger image with borderBlogger image without border

How to Delete, Remove, Get Rid of the Image Border in Blogger Posts
The following instructions will remove the little border around the images in your Blogger posts.
  1. Login into Blogger if not already logged in
  2. From the Dashboard navigate to your blog. Go to Design > Edit HTML by clicking on the Design tab and then choosing the Edit HTML link
  3. Back up your existing Blogger template by clicking on theDownload Full Template button
  4. Find the following code in your Blogger template (no need to check the Expand Widgets Template box as we are only working with the CSS Style Sheet). Note: the code in Blogger templates varies but this is the code you will find on a Blogger Minima template and most other default Blogger templates.

    .post img {
    padding:4px;
    border:1px solid $bordercolor;
    }

    If you do not have this code look for the following:
    img{
    padding: 4px;
    border:1px solid $bordercolor;
    }

  5. There are two ways to get rid of the unwanted border image code. You can either:
    • Remove the following line:
      border:1px solid $bordercolor;
      or
    • Change it to the following
      border:0px;

  6. Click on the Save Template button
  7. Click View Blog to admire your post images minus any image border.

How to Change the Color of the Image Border Around Posts in a Blogger Template 
The following instructions will show you how to change the color of the border which appears around images in your Blogger posts
  1. Follow Steps 1 to 4 as per removing the image border from Blogger posts.
  2. There are several methods to change the color of the image border but the easiest is to
    • Change the following line: 
      border:1px solid $bordercolor;

      to
      border:1px solid #6698FF;

      The above change will make the border line color sky blue. To change the color (in red) to your own color choice replace with the hex color code for your chosen color

  3. Click the Save Template button to save your changes
  4. Click on View Blog to admire the new color around the images in your Blogger posts

Tips and Troubleshooting
  • To change the image border line style from a solid line to a dotted line change the word solid to dotted eg
    border:1px dotted $bordercolor;

  • To change the image border line style from a solid line to a dashed line change the word solid to dashed eg
    border:1px dashed $bordercolor;

  • To increase the width of the image border change the size from 1px to 2px or 3px eg
    border:3px solid $bordercolor;

  • To Remove The Image Border Around Only One Image paste the following into your image code in your Blogger post:
    style="border:none"
    eg
    <img style="cursor:pointer; cursor:hand;width: 126px; height: 22px;" src="http://3.bp.blogspot.com/_vLeiVavkV_M/SrRp2wb1I_I/AAAAAAAAAAA/XXXXXXXXX/s200/download-now.png" border="0"style="border:none"alt=""id="BLOGGER_PHOTO_ID_XXXXXXXXXXXX" />

In this Blogger tutorial you have learned how to remove, delete and get rid of the line border which appears around images in your Blogger posts (Blogspot posts). You have also learned how to change the line color of the border image to your own chosen hex color. In addition I have shown you how to change the line style from solid to dotted or dashed and to remove the border around a single image. As always any problems with making these changes please let me know. Good luck!


Related Articles
List of Blog Know How Tutorials for Blogger Blogs
How to Remove the Image Border in Blogger Simple Template

How to Align and Justify Blogger Posts





This is the second article in a series about CSS styling tricks and tips for Blogger written with Blogger beginners and novices in mind but suitable for all bloggers who want to customize their existing Blogger template. While the first article dealt with how to add or remove image borders in Blogger today I show you how to align and justify Blogger posts.
Skill Level: BeginnerRating: EasyTime: 1 Minute

Many of the questions that my readers ask me are about how to customize various features of their Blogger template (Blogspot template). Over the coming weeks I will be focusing on some simple CSS styling tricks and tips to help you get more out of your Blogger template. Much can be achieved by learning a little about CSS. So before you rush off to download a custom Blogger template consider customizing your existing Blogger template. 

This tutorial is part of a series of articles that I will publishing over the coming weeks about customizing your Blogger template using CSS styling. I will be targeting beginner bloggers and newbies to Blogger as well as more seasoned bloggers so if you want to spice up your Blogger template please read along.

How to Justify Blogger Posts (Blogspot Posts) Using CSS
It is easy to change the text alignment of your Blogger posts with the addition of one extra line in the CSS styling section of your Blogger template (Blogspot template). By default the alignment is set to left align so that the text aligns to the left while the right edge is ragged. You can also have right alignment where the text aligns to the right and the left edge is ragged. 

Another not so common option is to justify the text so that both left and right edges are straight. Users of MS Word and other word processing programs will be familiar with justify as an alignment choice. Justify stretches out the text so that each line has an equal width similar to what you will find in newspapers and magazines. I have found justifying my Blogger posts to be a useful feature on several of my blogs and thought some of you might to. Below are instructions on how to justify your Blogger posts so that all your blog's articles are justified but first take a look at the difference in presentation of these 2 blog posts just by justifying the alignment of the text. Makes a big difference don't you think?

Blogger post text is left aligned
Blogger post text is justified
  1. Before you start check how text is currently aligned on your Blogger posts. If it is left aligned you will be able to follow this trick to justify it. If it is already justified no need to go any further.
  2. Login to Blogger if not already logged in
  3. From the Dashboard click the Layout link for your blog and then click on Edit HTML
  4. Back up your template by downloading it in full as a precaution
  5. Use CTRL + F to find the code block beginning with .post in the CSS styling section of your Blogger template. As templates will differ greatly there are no hard and fast rules about what styling will be in this block. Here is a typical code block taken from the default Minima Blogger template
    .post {
    margin:.5em 0 1.5em;
    border-bottom:1px dotted $bordercolor;
    padding-bottom:1.5em;
    }

  6. Add the following line to the code block before the end brace (the end curly bracket)
    text-align:justify;

    so that your code now looks like:

    .post {
    margin:.5em 0 1.5em;
    border-bottom:1px dotted $bordercolor;
    padding-bottom:1.5em;
    text-align:justify;
    }

  7. Click on Save Template
  8. Click View Blog to see the alignment of all your posts has now changed to justified

Tips and Troubleshooting
  1. If your Blogger template justifies posts and you would like to left align them find the code beginning with .post in your Blogger template and add the following line to the block:
    text-align:left;

    so that your code now looks like:

    .post {
    margin:.5em 0 1.5em;
    border-bottom:1px dotted $bordercolor;
    padding-bottom:1.5em;
    text-align:left;
    }

  2. If you want the posts right aligned you would substitute the word right for left.

In this tutorial you have learned how to justify your Blogger posts to create a straight rather than ragged margin edge. By using this tip to add one line of code to your Blogger template you can enhance the look of your Blogger posts. This tweak only takes a minute but can markedly improve the presentation of your Blogger posts. Please keep reading along for more CSS tips and tweaks in the coming weeks.

Related Articles
List of Blog Know How Tutorials for Blogger Blogs
How to Add, Delete or Remove Blogger Image Borders

Add a Post Divider Between Blogger Posts




In today's Blogger tutorial I show you how to enhance your Blogger blog (Blogspot blog) by adding a post divider to your Blogger template. Used effectively post dividers can really jazz up your blog and will lend it that individual feel which most of us are hoping to create.

This tweak is very easy and well within the capabilities of any Blogspot blogger. Only a few simple changes to your Blogger template are required and these are in the CSS styling section.

How to add a post divider between posts in Blogger
By way of example I will use a divider that I downloaded from the internet free by searching for free divider graphics. Here are some sample dividers you can use to get started:

URL address:
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3WWJVi444rKPCrLpBrHrsHId_9Q4lU6MgBEv39CMHX0AM6qegF0dDoesZOsypegyHbO-_nOavKb_dNBx513xBGErqCGowsgmzaR8AYpGaoNXayR-Lru-7cjfEMZF1QRuU7xmfFPqNzBo/s400/ribbon.gif


URL address:
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMRdnMZXMnrE8gNW1REngBCLJ9ty9afUrgnrk_Ctm1KXZIgFcaApE8PS1TsTcx6qbnO22wyPi0rbbIEoSyqEb7Lj3nRqMG3Nmr7K6uTS0FVg0bi_xNkCU7_HILfMcNzEP_4sxDw8P0W6M/s400/bar1.gif


URL address:
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7nrFyimcMPn9wZb_uVLC2lNLub_eK1rT0Z_62R6lIBKTKgCdotNTIjGBus8_i-nwQ2_dk0nQvpO5ef6ctXp5IIEvJulCrBtuM7TrAEJN1opeHtlIQ693auSGdpXpT4uX4s96M-Jsmydc/s400/barbsmpl.jpg


URL address:
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6AuwHmUJZrUpxUTWV4ThPJzu5Kylybl0yamQM4vypT5jEmdOx9ufY0TNgZcl9r-4zHwnLgSiCz6U-d_HKuCmth7sre-TFvN3lIw-3fb8Tl1BeU2-pm-Ipqm-bZEDB4wLWpNqK3mI27Zc/s400/bar47.gif


How to Add a Divider Between Posts in Blogger
  1. Login to Blogger if not already logged in
  2. From the Dashboard navigate to Layout > Edit HTML
  3. Back up your Blogger template as a precaution by downloading it to your computer
  4. Find the following line of code in your template:
    .post {

    You are likely to have something like this in your template already:

    .post {
    margin:.5em 0 1.5em;
    border-bottom:1px dotted $bordercolor;
    padding-bottom:1.5em;
    }

  5. Paste the following lines of code to this block making sure you paste them before the closing curly bracket:
    background: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3WWJVi444rKPCrLpBrHrsHId_9Q4lU6MgBEv39CMHX0AM6qegF0dDoesZOsypegyHbO-_nOavKb_dNBx513xBGErqCGowsgmzaR8AYpGaoNXayR-Lru-7cjfEMZF1QRuU7xmfFPqNzBo/s400/ribbon.gif);
    background-repeat: no-repeat;
    background-position: bottom center;
    margin:.5em 0 1.5em;
    padding-bottom:1.5em;

  6. If any lines are duplicated remove them.
  7. Remove any line beginning with: border-bottom: eg
    border-bottom:1px dotted $bordercolor;

  8. You will now have a block of code which looks like this plus any extra lines from the existing code in this block:
    .post {
    background: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3WWJVi444rKPCrLpBrHrsHId_9Q4lU6MgBEv39CMHX0AM6qegF0dDoesZOsypegyHbO-_nOavKb_dNBx513xBGErqCGowsgmzaR8AYpGaoNXayR-Lru-7cjfEMZF1QRuU7xmfFPqNzBo/s400/ribbon.gif);
    background-repeat: no-repeat;
    background-position: bottom center;
    margin:.5em 0 1.5em;
    padding-bottom:1.5em;
    }

  9. Click on Save Template to save your changes
  10. Click on View Blog to see your new post divider between posts

Tips and Troubleshooting
  • To change the divider to one of the above replace the URL address of the image (in red) with the URL address of the new image you want to use.
  • To use your own divider image download to your computer from the internet and then save the image to a photo image service like Photobucket. Replace the divider image URL address (in red) with the URL address of your new image
  • To increase the padding around the divider change the following line of code:
    padding-bottom:1.5em;

    to

    padding-bottom:2.5em;

In today's Blogger tutorial you have learned how to insert a divider between your Blogger posts to enhance the look of your Blogger template (Blogspot template). You can either make your own post divider or download one from the myriad of free website dividers available on the net.

Related Articles
List of Blog Know How Tutorials for Blogger Blogs
How to Add, Delete or Remove Blogger Image Borders
How to Align and Justify Posts in Blogger

Add or Change Background Image of a Blogger Template







In today's Blogger tutorial (Blogspot tutorial) I will show you how to both add a background image to a Blogger template if you don't have one already or change the existing background of your Blogger template.

I have chosen to write this article not because there aren't any how to articles already on the net but because they assume quite a bit of knowledge. I have taken a different tack with this post in that I assume you are an absolute beginner with no knowledge of Blogger templates.

For this reason I have provided some sample backgrounds for you to play around with. By just cutting and pasting these images you can see first hand how dramatically adding a different background to your Blogger template can change it. You will see that replacing your background image with these images isn't that difficult and hopefully it will give the confidence to branch out further and change the background of your Blogger template to suit your own needs. All that is needed is to insert a small snippet of code into the CSS styling section of your Blogger template and hey presto your Blogger template will take on a whole new look.

How to Change the Color of a Blogger Background (Default Templates)
If you are using a default Blogger template then you already have the option to change the background color to your own taste by going toLayout > Fonts and Colors. Some third party custom Blogger templates have this option too but by no means all. For instructions on changing the background color of custom templates see tips and troubleshooting below.

How to Add a Background Image to a Blogger Template
  1. Log in to Blogger if not already logged in
  2. Go to Layout > Edit HTML
  3. Back up your Blogger template as a precaution by downloading the full template to your computer
  4. Find the following line in your Blogger template
    body {

  5. Add the following line directly after this line 
    background-image: url(URL address of your image);

    Your block of code will now look like this:
    body {
    background-image: url(URL address of your image);
    (existing code in this block)
    }

  6. Now replace the code in red for the URL address of your image. Choose an image from the selection below to practise with or use your own image. Note if using your own image make sure you read the tips and troubleshooting section below.


    https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzorfWYcHWMQyC7yEF20t-glcD1Z6Ie5mzP6G5cgxmi4vOeKdzgXgstLc4rzJt0W0xgo-0Xyr_c0Py97zuPn-svyJHF3PgVUFbeOjT_KFGkFGEmkWsTteJEFsUxFHC4IWR-P78m3dDenU/s320/background_047.gif


    https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTmPw88HV-k24ehCAxP5yjDoh3pJGH8DSceweLIIwZP87TSUZCGs0fLJs1xWxeZB03tHRdtp_AKHEZfvR-hDtquyxbpyrKkaA1gM1ns7gxDHfCjpm55O3fTZ4BTyMIomRapzMKWKT8Wpc/s320/background_104.gif


    https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOEJmegJLKVzP1ADw-Y-Hnem4DCsyVRxRIKbLcp1EvnfrS0m5h4yCNstTdV_i6IfzhRyGfLpS-fRuezGNaEaJcedJifGJkuMlesdIHhYRiddiL_MoYwzOzK0NK_ZokBe3B7Eux_eyKlW4/s320/background_126.gif


    https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgo89-gOpKGGKn6jndi8Hl-S_lNPUT0MLlm06oIshM9ZL-FMGrAA1FOYn1hZLHd0mZxPGwRvaD4gAKBXP-0cmtZKl7wtFzTGuCxfHp0mCNy7papbmzHat_RUBhFGSTTrTlvmlug7AelhPQ/s320/background_073.gif


    https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtT4c2wYIp-R2EsIbKMyWRfWjgHPSRpsukguKEB0-mfaBCOmDkQaUI7WdAhzzrOUQAlFobobPtf3cceYW_UIh_7rAzu_-lLQOfIlBZLrP9wF0y6vUAGliz-pS61fk110alUu0tDBs44DE/s320/background_083.gif

    Green Paws Background

    https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-HY9ojADKolUWh503KDM25-FZmi2uTbOe-7M-_0RlRffrQvd2m1PCnZbVnQgOTuSc0GJa-Pzw_23PfzGSVap04O5_HOLZUid2NWV2M3ZmqWVyrHMe_V1xN-CStdPnLInSA_c9LD7h9NM/s320/green-paws.gif

    Musical Notes Background

    https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgni0ov3xL2NQO6WRx6Ycz30PcMdOc99o3dNWjU-hspyzr-SmjV1Xh0dmH4ALRCQzRlAlOyseKBDNJAkN5HorNFh79sRi4LtnOJlk6dDUkHFSjUF5QWRY0otwA5g-Ctr9KybCDAnXUskfg/s320/melody.gif
  7. Use the Preview button to see the effect of these different backgrounds on your template. It will help you get an idea of the kind of possibilities out there.
  8. You are welcome to use one of the above Blogger backgrounds as they are all free to use without any restriction. If you decide to use one of these simply click on Save Template and you are in business. Alternatively go ahead and find your own background image on the net and follow the instructions below to insert it into your Blogger template.

Tips and Troubleshooting
  • To Add Your Own Image to a Blogger Template
    There are huge number of backgrounds on the net that are suitable for Blogger. Search under free website backgrounds in your favorite search engine to find these.

    Simply download your preferred background and save to an image service like PhotobucketFlickr.

    Make sure the file format is either a .jpg, .gif or .png and that its size does not exceed 100kbs. As a rule of thumb an image size of around 30kb or less is about right if loading time speed is not to be compromised. Larger images can be resized quickly by using an online resizing service such as Shrink Pictures.

    Follow the instructions above to change the URL to that of your image.
  • To Change the Background Color of Your Custom Blogger Template
    If there is no option to change the background color of your Blogger template in Layout > Fonts and Colors you can still change the color manually.
    1. Follow steps 1 to 4 as above
    2. Find the line beginning with :
      background-color: #

    3. The hex color will be different for each template. We will change the color only
      background-color: #change hex color code to your chosen color;

    4. Replace the existing hex color code with the value of your chosen hex color. List of web safe hex colors. For example insert the following code to change the background color to:

      Denim Blue
      background-color: #336699;

      Black
      background-color: #000000;

      White
      background-color: #ffffff;

    5. Use the Preview button to see the effect of each color before you save it.
    6. Once you are satisfied go ahead and click on Save Template

Today's Blogger tutorial (Blogspot tutorial) aimed at Blogger beginners continues the series on CSS styling for Blogger. You have learned how to add the background image to your Blogger template or change the existing background image. To help you gain confidence in changing the background image I have provided some sample images for you to practise with. Also in this Blogger tutorial you have learned how to change the color of your Blogger background if you prefer a plain solid background color rather than a background image. As always if you strike any problems implementing the tips in this tutorial please let me know.

Related Articles
List of Blog Know How Tutorials for Blogger Blogs
How to Add, Delete or Remove Blogger Image Borders
How to Align and Justify Posts in Blogger
How to Add a Divider Between Blogger Posts

Add CSS Styling to Blockquotes in a Blogger Template





Today I continue the series of Blogger tutorials (Blogspot tutorials) by showing you how to apply CSS styling to blockquotes in a Blogger template. Other articles I have already published on the subject of CSS styling include:

How to Add, Delete or Remove Blogger Image Borders
How to Align and Justify Posts in Blogger
How to Add a Divider Between Blogger Posts
How to Add or Change a Background Image in a Blogger Template.

Today's tutorial on Blogger blockquotes will be useful if you are using a default Blogger template or a third party custom template. It will show you how to change your blockquote area in the following ways:
  • Add a background color to the blockquote
  • Add a border around the background of the blockquote
  • Add or change the color of the blockquote text
  • Add or change padding around the text
  • Add or change the margin
  • Add a background image

Blogger beginners you can relax as I have written this Blogger tutorial with you in mind. I will walk you through the steps of styling the blockquote section and you will see that it is not as daunting as it first appears. This Blogger tutorial assumes no knowledge of CSS styling. I have rated the difficulty level as easy to medium because it does involve making adjustments to your Blogger template.

How to Change the Blockquote Section of a Blogger Template

First of all let's take a look at the CSS Styling for the blockquote section of a default Minima Blogger template. 
.post-body blockquote {
line-height:1.3em;
}

.post blockquote {
margin:1em 20px;
}

.post blockquote p {
margin:.75em 0;
}

As you can see the blockquotes area of this Minima template has minimal styling. Apart from line height and margin indentation there has been no additional code added to improve the look of the template. 

Minima Blockquotes No Extra CSS Styling
Let's go ahead and give the blockquotes in your Blogger posts some styling. I will use the Minima template to show you but you can do the same for another default template or custom template. As always back up your Blogger template by downloading it to your computer before you begin to make any changes.
  1. CSS Styling to Add a Background Color to Blockquotes
    Adding a background color to the blockquote area can be achieved in 1 of 2 ways.
    1. One way is to enter the hex color directly into the styling as I have done below. This code will add a light grey background to the blockquote area.
      .post-body blockquote {
      line-height:1.3em;
      background-color: #cccccc;
      }

    2. Another way to add a background color using CSS styling for the blockquote area is to make use of the variable names already set up. The border color is light grey #cccccc by default in a Minima template. The advantage of this option is that if you decide to change the border color under Layout > Fonts and Colors the blockquote color will automatically change to the new color too.
      .post-body blockquote {
      line-height:1.3em;
      background-color: $bordercolor;
      }

      If you wanted the background color to be the same as the blog title color rather than the border color you would write this instead
      .post-body blockquote {
      line-height:1.3em;
      background-color: $titlecolor;
      }

  2. CSS Styling to Add a Border Around Blockquotes
    You have your background in place now let's add a narrow border around the background to add some more definition. The following will add a 1px solid border around the outside of your blockquote area in your Blogger posts.
    .post-body blockquote {
    line-height:1.3em;
    background-color: #cccccc;
    border: 1px solid #cc6600;
    }

    or if using variables
    .post-body blockquote {
    line-height:1.3em;
    background-color: $bordercolor;
    border: 1px solid $titlecolor;
    }

    Blockquotes With a Background and Background Border
  3. CSS Styling to Add Padding Around Blockquotes
    Now if we were to leave the styling at this point one of the problems would be that the text would butt up against the background which is not a good look. To create some space between the text and the background edge all the way around we use CSS styling to add some padding like this:
    .post-body blockquote {
    line-height:1.3em;
    background-color: #cccccc;
    border: 1px solid #cc6600;
    padding: 20 px;
    }

    or if using variables
    .post-body blockquote {
    line-height:1.3em;
    background-color: $bordercolor;
    border: 1px solid $titlecolor;
    padding: 20 px;
    }

    Blockquotes With a Background, Background Border and Padding
  4. CSS Styling to Add or Change the Text Color of Blockquotes
    If you want to accent your blockquote area in your posts one effective way to do this is to make the blockquote text color a different color from the text color of your pages. We do this by picking a color and adding the following line to the code:
    .post-body blockquote {
    line-height:1.3em;
    background-color: #cccccc;
    border: 1px solid #cc6600;
    padding: 20 px;
    color: #cc6600
    }

    or if using variables
    .post-body blockquote {
    line-height:1.3em;
    background-color: $bordercolor;
    border: 1px solid $titlecolor;
    padding: 20 px;
    color: $titlecolor;
    }

    Blockquotes With a Background, Background Border, Padding and Change of Text Color

Tips and Troubleshooting
If you want to add further modifications to the blockquotes area of your Blogger template here are several other possibilities.
  1. CSS Styling To Change the Margin of Blockquotes
    You can increase the margin from 1em to 1.5em by changing the margin line to
    margin: 1.5em 20px;

  2. CSS Styling to Add a Background Image to Blockquotes
    You can have your own image as a background in your blockquotes area of your posts by adding this line:
    background: url(http://URL of your image.jpg);

In today's Blogger tutorial (Blogspot tutorial) you have learned how to add CSS styling to the blockquotes area of your Blogger posts. I have shown you how to add a background, a background border, change the text color, add padding, change the margin and add a background image to the blockquotes code block. If you have a moment please let me know how you got on customizing your own Blogger template. Any questions please ask.


Related Articles
List of Blog Know How Tutorials for Blogger Blogs
How to Add, Delete or Remove Blogger Image Borders
How to Align and Justify Posts in Blogger
How to Add a Divider Between Blogger Posts
How to Add or Change a Background Image in a Blogger Template

How to Highlight Author Comments in Blogger Posts





In this Blogger tutorial I will show you how to highlight the author comments section of your Blogger template (Blogspot template) using CSS styling.

Benefits of Adding CSS Styling to Author Comments
If you are using a default Blogger template chances are it is difficult to differentiate between comments made by visitors and comments made by you, the blog author. If you only have a few comments per post that may not be enough of an issue for you. If however, you have some posts with lots of comments you may need to make your remarks stand out from those of your visitors. We can do that by adding CSS styling to highlight your author comments.

What Will I Learn in This Tutorial?
In this Blogger tutorial you will learn how to easily add some highlighting to your comments so that they will never get lost in the crowd again. This requires a small amount of tweaking to your Blogger template which is not difficult to do if care is taken. The image below shows one example of what can be achieved using this Blogger hack and some CSS styling.



Will This Blogger Hack Work on My Template?
I have tested this Blogger hack on both the old generation of Blogger templates (Minima and Sand Dollar) and the latest generation of default Blogger templates eg Simple. It will also work on custom templates as the comments code is likely to be very similar.

If you are using a custom Blogger template and run into difficulty you can also try this alternative method to highlight author comments in Blogger posts

How to Add CSS Styling to Author Comments in a Blogger Post
The following instructions will highlight author comments in the comments section of a Blogger post. The code creates a shaded box around the comments made by the blog author. These changes will not affect the CSS the styling of any of the other comments made.

Instructions to Add CSS Highlighting to Author Comments in Blogger
  1. Login to Blogger
  2. From the Dashboard go to Design > Edit HTML
  3. Back up your template by downloading it to your computer
  4. Check the Expand Widget Templates checkbox on the top righthand side
  5. Use CTRL + F by entering the following into the search box
    <dd class='comment-body'>

  6. Immediately above this line paste the following code:
    <b:if cond='data:comment.author == data:post.author'>
    <dd class='comment-body-author'>
    <p><data:comment.body/></p>
    </dd>
    <b:else/>

  7. Now look for this code block
    <dd class='comment-body'>
    <b:if cond='data:comment.isDeleted'>
    <span class='deleted-comment'><data:comment.body/></span>
    <b:else/>
    <p><data:comment.body/></p>
    </b:if>
    </dd>

    and paste </b:if> immediately after it.
  8. Your code will now look like this:
    <div expr:id='data:widget.instanceId + &quot;_comments-block-wrapper&quot;'>
    <dl expr:class='data:post.avatarIndentClass' id='comments-block'>
    <b:loop values='data:post.comments' var='comment'>
    <dt expr:class='&quot;comment-author &quot; + data:comment.authorClass' expr:id='data:comment.anchorName'>
    <b:if cond='data:comment.favicon'>
    <img expr:src='data:comment.favicon' height='16px' style='margin-bottom:-2px;' width='16px'/>
    </b:if>
    <a expr:name='data:comment.anchorName'/>
    <b:if cond='data:blog.enabledCommentProfileImages'>
    <data:comment.authorAvatarImage/>
    </b:if>
    <b:if cond='data:comment.authorUrl'>
    <a expr:href='data:comment.authorUrl' rel='nofollow'><data:comment.author/></a>
    <b:else/>
    <data:comment.author/>
    </b:if>
    <data:commentPostedByMsg/>
    </dt>


    <b:if cond='data:comment.author == data:post.author'>
    <dd class='comment-body-author'>
    <p><data:comment.body/></p>
    </dd>
    <b:else/>


    <dd class='comment-body' expr:id='data:widget.instanceId + data:comment.cmtBodyIdPostfix'>
    <b:if cond='data:comment.isDeleted'>
    <span class='deleted-comment'><data:comment.body/></span>
    <b:else/>
    <p>
    <data:comment.body/>
    </p>
    </b:if>
    </dd>

    </b:if>

    </dd>
    <dd class='comment-footer'>
    <span class='comment-timestamp'>
    <a expr:href='data:comment.url' title='comment permalink'>
    <data:comment.timestamp/>
    </a>
    <b:include data='comment' name='commentDeleteIcon'/>
    </span>
    </dd>
    </b:loop>
    </dl>
    </div>

  9. Now using CTRL + F again find this line ]]></b:skin>
  10. Paste the following immediately before ]]></b:skin>
    .comment-body-author {
    background: #f5deb3;
    border: 2px solid #de7008;
    padding: 5px;
    }

  11. Save your template changes
  12. Click on View Blog and go to a post that you have commented on to see the CSS styling has highlighted your comments.


Alternative Method to Add Highlighting to Author Comments in Blogger
The following method will also add highlighting to author comments in Blogger and can be used if you have difficulty with the first method. It does however involve changing some code rather than just adding some so this is not as desirable in terms of future proofing your template for Blogger updates. 


  1. Login to Blogger
  2. From the Dashboard go to Design > Edit HTML
  3. Back up your template by downloading it to your computer
  4. Check the Expand Widget Templates checkbox on the top righthand side
  5. Find the following section of code by using CTRL + F and entering <data:comment.body/> into the search box
    <span class='deleted-comment'><data:comment.body/></span>
    <b:else/>
    <p><data:comment.body/></p>
    <b:include data='comment' name='commentDeleteIcon'/>
    </b:if>

  6. Replace with the following code after <span class='deleted-comment'> and before </b:if> as shown in red:
    <span class='deleted-comment'>
    <!--Highlight Author Comments Start-->
    <b:if cond='data:comment.author == data:post.author'>
    <p class='comment-body-author'><data:comment.body/></p>
    <b:else/>
    <p><data:comment.body/></p>
    </b:if>
    <!--Highlight Author Comments End-->

    </b:if>

  7. Use CTRL + F to find ]]></b:skin> that closes the CSS styling section
  8. Paste the following code immediately above ]]></b:skin>
    p.comment-body-author {
    background: #eeeecc;
    border: 2px solid #335577;
    padding: 5px;
    color:#558866;
    }

  9. Save your template
  10. Click on View Blog and navigate to a post that you have commented on to see the that your comments will now be highlighted


In this Blogger tutorial you have learned two different methods to add CSS styling to highlight the author comments in your Blogger posts. Obviously there is still some work to do on your part to adjust the colors in the CSS styling to match the color scheme of your blog. Good luck!


Related Articles
List of Blog Know How Tutorials for Blogger Blogs
Embedding a Comment Form Below Each Post
How to Get More Comments on Your Blogger Blog
Add Missing Embedded Comment Form to Blogger