1

Am trying to place material icon in center of circle i tried following method tried adding vertical-align:middle and added text-align:center

but nothing work.

@font-face {
  font-family: 'Material Icons';
  font-style: normal;
  font-weight: 400;
  src: url(https://fonts.gstatic.com/s/materialicons/v41/flUhRq6tzZclQEJ-Vdg-IuiaDsNc.woff2) format('woff2');
}

.mi {
  font-family: 'Material Icons';
  font-weight: normal;
  font-style: normal;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
}

a {
  border: 1px solid #3D3E02;
  border-radius: 50%;
  padding: 10px;
  color: #334048;
}

a i {
  font-size: 20px;
}
.t{vertical-align:middle}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css" rel="stylesheet" />
<br><br><br>
<a href="#"><i class="mi">&#xe0be;</i></a>
<br><br><br>
<a href="#"><i class="mi t">&#xe0be;</i></a>
sanoj lawrence
  • 951
  • 5
  • 29
  • 69

3 Answers3

1

I have changed the .t{vertical-align:middle} to .t{vertical-align:bottom} and it worked fine for me.

@font-face {
  font-family: 'Material Icons';
  font-style: normal;
  font-weight: 400;
  src: url(https://fonts.gstatic.com/s/materialicons/v41/flUhRq6tzZclQEJ-Vdg-IuiaDsNc.woff2) format('woff2');
}

.mi {
  font-family: 'Material Icons';
  font-weight: normal;
  font-style: normal;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
}

a {
  border: 1px solid #3D3E02;
  border-radius: 50%;
  padding: 10px;
  color: #334048;
}

a i {
  font-size: 20px;
}
.t{vertical-align:bottom}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css" rel="stylesheet" />
<br><br><br>
<a href="#"><i class="mi">&#xe0be;</i></a>
<br><br><br>
<a href="#"><i class="mi t">&#xe0be;</i></a>

Is this you are looking for.? Hope this solved your issue.

Jithin Raj P R
  • 6,667
  • 8
  • 38
  • 69
0

Use display: inline-flex; to a

@font-face {
  font-family: 'Material Icons';
  font-style: normal;
  font-weight: 400;
  src: url(https://fonts.gstatic.com/s/materialicons/v41/flUhRq6tzZclQEJ-Vdg-IuiaDsNc.woff2) format('woff2');
}

.mi {
  font-family: 'Material Icons';
  font-weight: normal;
  font-style: normal;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
}

a {
  display: inline-flex;
  border: 1px solid #3D3E02;
  border-radius: 50%;
  padding: 10px;
  color: #334048;
}

a i {
  font-size: 20px;
}
.t{vertical-align:middle}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css" rel="stylesheet" />
<br><br><br>
<a href="#"><i class="mi">&#xe0be;</i></a>
<br><br><br>
<a href="#"><i class="mi t">&#xe0be;</i></a>
לבני מלכה
  • 15,925
  • 2
  • 23
  • 47
0

Change the styles:

from:

a {
  border: 1px solid #3D3E02;
  border-radius: 50%;
  padding: 10px;
  color: #334048;
}

to

a{
}

from

a i {
    font-size: 20px;
}

to

a i {
    font-size: 20px;
    border: 1px solid #3D3E02;
    border-radius: 50%;
    padding: 10px;
}
Bhimashankar Mantur
  • 189
  • 1
  • 3
  • 12