Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I center this number inside the circle? - CSS

Tags:

html

css

You can see the implementation here

I would like the numbers in the top left of each box, to be centered in the middle of the circles.

Help!

like image 673
marcamillion Avatar asked Dec 16 '10 19:12

marcamillion


People also ask

How do you bend and set text in a circle in CSS?

We can do this by using the span tag on each single text. First, we need to wrap all texts in a container ID named simple_arc, then, put each letter on a span tag. We will also need to put a unique class to each spanned text to optimize their position later on using CSS.

How do I make a circle div in CSS?

To create a circular div in CSS, follow the same steps as above. Add a div in HTML. Then, set the width and height of the element to the same value. Finally, specify the value of the border-radius property to 50%.


1 Answers

Set line-height to the height of the box and use text-align: center;

So you would get, for example :

div {
    width: 100px;
    height: 100px;
    line-height: 100px;
    text-align: center;
}
like image 122
Tom van der Woerdt Avatar answered Sep 30 '22 16:09

Tom van der Woerdt