【发布时间】:2018-05-19 00:03:00
【问题描述】:
我正在尝试使用 IcoMoon 将搜索图标添加到 <input type="submit">。我不能在<input> 中包含<i>。
我尝试了以下使用伪元素:before的方法,但不起作用。
HTML:
<div class="top-search">
<form class="navbar-form navbar-right">
<input type="text" class="form-control" placeholder="Search...">
<input type="submit" class="icon-search" value="e90e">
</form>
</div>
CSS:
@font-face {
font-family: 'icomoon';
src: url('icomoon.eot?lkqd5y');
src: url('icomoon.eot?lkqd5y#iefix') format('embedded-opentype'),
url('icomoon.ttf?lkqd5y') format('truetype'),
url('icomoon.woff?lkqd5y') format('woff'),
url('icomoon.svg?lkqd5y#icomoon') format('svg');
font-weight: normal;
font-style: normal;
}
[class^="icon-"], [class*=" icon-"] {
font-family: 'icomoon' !important;
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-search:before {
content: "\e90e";
}
【问题讨论】: