1

我试图放置material icon在圆心我尝试了以下方法尝试添加vertical-align:middle和添加text-align:center

但没有任何工作。

@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>

4

3 回答 3

1

我已将其更改.t{vertical-align:middle}.t{vertical-align:bottom},它对我来说效果很好。

@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>

这是你要找的。?希望这解决了您的问题。

于 2018-08-23T11:48:35.920 回答
0

用于 display: inline-flex;_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>

于 2018-08-23T11:41:16.947 回答
0

更改样式:

从:

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

a{
}

a i {
    font-size: 20px;
}

a i {
    font-size: 20px;
    border: 1px solid #3D3E02;
    border-radius: 50%;
    padding: 10px;
}
于 2018-08-23T11:46:55.630 回答