CSS: Character inside a round element

Asked

Viewed 794 times

2

I need to create an element (span, possibly) that will contain a character (initial letter of name) and that element needs to have rounded corners.

I managed to do it in a precarious way, because depending on the letter, the shape of the element is no longer an exact round. What is the best way to do this?

Below is an example of what I need.

Exemplo de como deve ficar a letra/elemento

2 answers

4


.circle
    {
    width:50px;
    height:50px;
    border-radius:25px;
    font-size:25px;
    color:#fff;
    line-height:50px;
    text-align:center;
    background:#580000 
    }
<div class="circle">S</div>

  • Perfect, @psNytrancez! Exactly what I needed. Thank you!

  • @Danilomiguel was worth it!!

1

.borderRadiu{
    border-radius: 5em;
    background: #660000;
    padding: 5px 10px;
    color: #fff;
}
<span class="borderRadiu">S</span>

  • -1? would like to understand the explanation.

Browser other questions tagged

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