How can I create a circle in CSS with number in the center to use in wordpress

Asked

Viewed 1,713 times

-1

I’m starting in CSS and Wordpress, would like to create a pattern of articles with circle format with numbers in the center.

My idea is for a bingo site, then I would like to update only the numbers, leaving the circle format as standard.

Something like this. It’s possible?

inserir a descrição da imagem aqui

4 answers

3

Use properties of display: flex for vertical and horizontal alignment of the number, background degrade, box-shadow to create a shadow and border-radius: 50% to create a circle:

ul, li{
   margin: 0; padding: 0;
   list-style: none;
}

ul.circulo li, div.circulo{
   display: flex;
   align-items: center;
   justify-content: center;
   width: 45px;
   height: 45px;
   border-radius: 50%;
   float: left;
   margin: 4px;
   font-size: 30px;
   font-weight: bold;
   color: #555;

   background: -moz-linear-gradient(270deg, #f5f5f5 0%, #f5f5f5 16%, #999999 100%);
   background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #f5f5f5), color-stop(16%, #f5f5f5), color-stop(100%, #999999));
   background: -webkit-linear-gradient(270deg, #f5f5f5 0%, #f5f5f5 16%, #999999 100%);
   background: -o-linear-gradient(270deg, #f5f5f5 0%, #f5f5f5 16%, #999999 100%);
   background: -ms-linear-gradient(270deg, #f5f5f5 0%, #f5f5f5 16%, #999999 100%);
   background: linear-gradient(180deg, #f5f5f5 0%, #f5f5f5 16%, #999999 100%);
   filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f5f5f5', endColorstr='#999999',GradientType=0 );
   filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f5f5f5', endColorstr='#999999',GradientType=0 );

   -webkit-box-shadow: 2px 2px 2px 0px rgba(50, 50, 50, 0.75);
   -moz-box-shadow:    2px 2px 2px 0px rgba(50, 50, 50, 0.75);
   box-shadow:         2px 2px 2px 0px rgba(50, 50, 50, 0.75);
}
<h2>Com LI:</h2>

<br />

<ul class="circulo">
   <li>01</li>
   <li>02</li>
   <li>03</li>
   <li>04</li>
   <li>05</li>
</ul>

<br clear="all" /><br />

<h2>Com DIV:</h2>

<br />

<div class="circulo">01</div>
<div class="circulo">02</div>
<div class="circulo">03</div>
<div class="circulo">04</div>
<div class="circulo">05</div>

With divs:

  • New Trick: display:flex, did not know this! nice solution

  • That’s right! Only one problem, ended up modifying all the lists on the blog. How to change only when using this class? I think this is the problem: ul, li{ margin: 0; padding: 0; list-style: None; }

  • @Netooliveira E ae, blz? It’s just an example. You can take advantage of the code to do as you please, with Divs, for example. :)

  • How would I look with DIVS?

  • @Netooliveira I included in the answer with LI and DIV.

  • Damn life, it worked out! THANK YOU VERY MUCH friend! :)

  • @Netooliveira Be sure to mark the question to help other people. Abs!

Show 2 more comments

0

More or less that, main property is the border-radius:

.circulo{
 border: 1px solid #000;
 border-radius:30px;
 width:50px;
 height:50px;
 text-align:center;
 vertical-align: middle;
 background-color: #ffe;
 line-height:50px;    
 box-shadow: 2px 2px 5px #999;
}
<div class='circulo'>666</div>

0

Only use circular edge with gradient:

#num {
  width: 75px;
  height: 75px;
  box-shadow: inset -25px -25px 40px rgba(0,0,0,.5);
  display: flex;
  flex-flow: column;
  align-items: center;       /* alinhar verticalmente   */
  justify-content: center;   /* alinhar horizontalmente */
  font-size: xx-large;
  font-family: sans, serif;
  border: 1px solid #ccc;
  border-radius: 100%;
}
<div id="num">10</div>

Bonus: this video is a must-see for anyone who wants to start digging deeper into CSS borders https://www.youtube.com/watch?v=b9HGzJIcfDE

-2

in the CSS using border-radius = 100% I believe it’s the simplest way

  • Funny when I entered here in the question of the guy nobody had answered and had about 15 visits and when I decide to post to try to help I get negative point and as I see below all the same thing using border-Radius and masking with other options okay if you want to help but do not need to give negative ridiculous attitude of these guys.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.