How to use CSS to surround a number with a circle?

Pentium10 picture Pentium10 · Feb 1, 2011 · Viewed 367.7k times · Source

I would like to surround a number in a circle like in this image:

Number in Circle Image

Is this possible and how is it achieved?

Answer

thirtydot picture thirtydot · Feb 1, 2011

Here's a demo on JSFiddle and a snippet:

.numberCircle {
    border-radius: 50%;
    width: 36px;
    height: 36px;
    padding: 8px;

    background: #fff;
    border: 2px solid #666;
    color: #666;
    text-align: center;

    font: 32px Arial, sans-serif;
}
<div class="numberCircle">30</div>

My answer is a good starting point, some of the other answers provide flexibility for different situations. If you care about IE8, look at the old version of my answer.