How to add a progress bar to your blog
02 Wednesday Apr 2014
Written by J. Abram Barneck in Blog Tips, Writing Tips
Some authors want to add progress bars to their blog. However, most authors are not web designers or developers. So they don’t know how to do this. Well, there is a secret in the html development world. The secret is that “Everything is easy once you know how to do it.” Yes, it is actually pretty easy to add a progress bar. I just added a progress bar to my blog.
Creating a Progress Bar on your Blog
Step 1. Create an HTML Widget for your side bar.
To complete this step, you need to understand two terms:
- Sidebar: On a web page you have the wide main part of the page and a thin part of the page on either side of the main part that usually has a menu, links, buttons, ads, etcc. That thin part is the sidebar.
- Widget or Gadget: A blog tool that allows you to create a menu, link, button, etc on you web page. Widget is the term WordPress uses. Gadget is the term Blogger uses.
To add your Widget in WordPress:
- Login to WordPress.
- Go to your WordPress Dashboard.
- From the left menu, click Appearance | Widgets
- Find the “Text” widget.
- Drag it to a sidebar.
To add your Gadget in Blogger:
- Log in to Blogger.
- Click the dropdown menu for you blog and choose Layout.
- Click Add Gadget (probably on the sidebar.
- Find the “HTML/Javascript” widget.
- Drag it to a sidebar.
You now have an empty widget on your sidebar and you are ready to add a progress bar.
Step 2. Paste in the following html code
1st draft of Book 2 <div id="progressbar" style="background-color:black;border-radius:6px;padding:3px;"> <div style="background-color:#dd6013;width:30%;height:10px;border-radius:4px;"></div> </div>
It will look like this:
1st draft of Book 2
You are currently looking at a WordPress example.
For a blogger example, see this site: https://jabrambarneck.blogspot.com
Step 3. Change the percentage
Look at the html code. Do you see the “width: 40%” in the example? That 40% is your percentage. Change it to whatever percentage you want.
Step 4. Change the colors.
Hopefully, I don’t have to explain this, but the the out div’s “background-color: black” style is what chooses the progress bar’s background. The inner div’s “background-color: orange” is what makes the progress bar orange. You can change these colors. Just don’t make them the same color, that defeats the purpose.
Now you can update the percentage at the first of each month and your readers can track your progress with you.
Adding multiple Progress Bars
Now you can paste two or more of these one after another in your sidebar widget to get two or more progress bars. Each one has its own percentage.
1st draft of Book 2 <div id="progressbar" style="background-color:black;border-radius:6px;padding:3px;"> <div style="background-color:#dd6013;width:40%;height:10px;border-radius:4px;"></div> </div> Short Story <div id="progressbar" style="background-color:black;border-radius:6px;padding:3px;"> <div style="background-color:#dd6013;width:65%;height:10px;border-radius:4px;"></div> </div>
It will look like this:
One more div
You may find you need one more div to wrap the title and the progress bar. I need one more div in my posts and so I used one more div for this post your are reading. However, for my widget, I didn’t need to do this.
<div>1st draft of Book 2 <div id="progressbar" style="background-color:black;border-radius:6px;padding:3px;"> <div style="background-color:#dd6013;width:40%;height:10px;border-radius:4px;"></div> </div> </div> <div>Short Story <div id="progressbar" style="background-color:black;border-radius:6px;padding:3px;"> <div style="background-color:#dd6013;width:65%;height:10px;border-radius:4px;"></div> </div> </div>
Changing the Width
By default the outer width is 100% which means it will be as wide as possible. In a sidebar, the outer width probably never needs to be changed. But if you add this to a blog post, it might get a little wide.
You can add a width to the outer div’s style as shown.
1st draft of Book 2 <div id="progressbar" style="width:200px;background-color:black;border-radius:6px;padding:3px;"> <div style="background-color:#dd6013;width:40%;height:10px;border-radius:4px;"></div> </div> Short Story <div id="progressbar" style="width:200px;background-color:black;border-radius:6px;padding:3px;"> <div style="background-color:#dd6013;width:65%;height:10px;border-radius:4px;"></div> </div>
It will look like this:
Have Access to Edit CSS
If you can edit your CSS, you can make your HTML code cleaner by putting much of the settings in CSS.
Here is a single web page example
<!-- Step 1 - Create the HTML File --> <!DOCTYPE html> <html> <head> </head> <style> .progressbar { background-color: #000000; -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; width: 200px; padding: 2.5px; margin:1px; vertical-align:10%; } .progressbar > div { background-color: #dd6013; height: 100%; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; color: #ffffff; text-align: center; } </style> <body> <div class="progressbar"> <div style="width: 75%;">75%</div> </div> <div class="progressbar"> <div style="width:40%;">40%</div> </div> <div class="progressbar"> <div style="width:30%;">30%</div> </div> </body> </html>
6 Comments
J. Abram barneck said:
April 2, 2014 at 10:30 am
Reblogged this on Utah Fantasy Authors and commented:
Hey all you authors with blogs out there. Let your readers see your progress!
C. Louis S. said:
April 3, 2015 at 2:17 pm
Thanks so much for this tip. It’s such a great idea. I already implemented it on my blog
Maureen Crisp said:
March 9, 2016 at 1:49 am
Thankyou for this nifty bit of code. I will add a link to your blog in my weekly roundup.
R.M. Donaldson said:
December 20, 2016 at 1:40 pm
Thanks for the great tool! It’s perfect! Keep up the great work!
sovotchka art said:
January 16, 2017 at 12:52 am
Thank you so much, this is really helpful!
I wanted to track time I spend creating illustrations, and couldn’t find anything useful at all until I remembered that some authors use progress bars for their books. As a reader, I really like them, because it help shorten the wait for the next book :).
TAHIPS said:
July 24, 2017 at 12:45 pm
Thank you so much! I’m using it on my blog now!