1. Web Design
  2. UX

Impress Your Visitors With a Web 2.0 Hit Counter

Read Time:5 minsLanguages:

If there's one way to show off how successful your site is, it's by letting your visitors know how many others have been there before them. Let's furnish a web page with a hit counter!

The first thing we'll need to do is design our counter, so open up Photoshop, Sketch or CorelDraw, and begin a new document.

Write 1234567890 on the canvas using the text tool. You can now style these numbers using whatever design influences you feel are current and trendy. Consider using gradients, perhaps Bold Times New Roman for the type, then bevel the heck out of them.

Note: you should certainly only use web safe colors, because any others endanger the web.

Great, we're making progress. You should now hopefully have something like the design below:

If you haven't managed to design something as good as this, take a sip of absinthe and try again.


Grab the Slice Tool (if you're using Microsoft Paint it's called the Bread Knife Tool) and make a whole load of rectangles all over the document.

The next thing you'll need is a 1x1px transparent GIF. Download one from a repo on the internet and save it as "spacer.gif", the name is really important. It should look a bit like this if you open it in Photoshop:

HTML Document

Kick off a new HTML document using your code editor of choice.

We should place our hit counter at the bottom of our page, more or less where webmasters usually place the animated horse GIFs, so we'll need to use quite a number of table cells to get the positioning right.

Begin with the following markup:

Tables are difficult, but fortunately Dreamweaver makes building them dead easy.

As you can see, we've built a perfect page structure which guarantees that everything will look exactly the same in every browser in the world. 

Tip: As with all responsive web designs, I highly recommend you test with as many devices as possible. Before going any further, simply head on down to your nearest shopping mall and purchase all the mobile phones you can find.


Remember those spacer.gif files we made earlier? It's now time to put them to use and properly size our layout. Place a spacer in every cell, apart from the center cell in the smallest table.

Now go through and resize all the spacers so that they push the table cells into place. Think of it like moulding cheese. 

The Counter Element

With our design complete and our HTML ready to go, we just have to insert the counter element. Add the following snippet to the only table cell which has been left empty:


Take a look at the fruits of your labor, we're done! Now we just need to FTP this through our VPN so the CDN can pick it up and let the ISPs deliver it through HTTP. Thank goodness for that, we can all get on with some proper work now.

Spectacularly Useful Resources

Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.