как расположить иконку в центре рамки?

body {
  background: black;
}

.fa {
  color: white;
  text-align: center;
  border: 6px solid white;
  border-radius: 100%;
  width: 1.5em;
  height: 1.5em;
  display: inline-block;;
  position: relative;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<i class="fa fa-facebook" style="font-size: 30px;"></i>


Ответы (1 шт):

Автор решения: De.Minov

Иконка добавляется через ::before, от центрируйте его, простой способ это position: absolute

body {
  background: black;
}

.fa {
  color: white;
  text-align: center;
  border: 6px solid white;
  border-radius: 100%;
  width: 1.5em;
  height: 1.5em;
  display: inline-block;
  position: relative;
}

.fa::before {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<i class="fa fa-facebook" style="font-size: 30px;"></i>

Либо через display: flex (inline-flex)

@import url('https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css');

body {
  background: black;
}

.fa {
  color: white;
  text-align: center;
  border: 6px solid white;
  border-radius: 100%;
  width: 1.5em;
  height: 1.5em;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  position: relative;
}
<i class="fa fa-facebook" style="font-size: 30px;"></i>

→ Ссылка