gpt4 book ai didi

html - 使用 IcoMoon 为输入类型提交添加图标

转载 作者:行者123 更新时间:2023-11-28 16:25:52 24 4
gpt4 key购买 nike

我正在尝试将搜索图标添加到 <input type="submit"> 中通过使用 IcoMoon。我不能包括 <i>里面<input> .

我尝试了以下使用伪元素的方法 :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";
}

最佳答案

<input>元素不允许有伪内容。您可以使用 <button type="submit">反而。这样您就可以使用 :before或添加 <i>直接标记进去。

关于html - 使用 IcoMoon 为输入类型提交添加图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36117704/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com