-1

I can't understand why when i add border to this element, the element isn't at the center of the border

enter image description here

My css :

.arrow
{
    font-size: 25px;
    color: #f9f9f9;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    border-radius: 50%;
    border: 1px solid #f9f9f9;
    height: 50px;
    width: 50px;
    text-align: center;
    margin: 0 auto;
}

My html :

<span id="slide_left" class="arrow"><i class="fas fa-chevron-left"></i></span>

I just want to have the element at the center of this border !

If someone knows why ? :)

2 Answers2

0

Try this css code:

.arrow{
  display: block;
  height: 50px;
  width: 50px;
  line-height: 50px;
  border-radius: 50%; 
  border: 1px solid #000;
  text-align: center;
  font-size: 25px;
}
-1

There is way too much going on in your css. Just start simple.

.arrow{

    font-size: 25px;
    padding: 5px;
    border: 1px solid black;
    border-radius:50%;

}
alex067
  • 3,159
  • 1
  • 11
  • 17