我不知道这是否可能,我正在寻找一种更改特定字符字体的方法,例如,我想制作这个按钮:
文本在css中具有"calibri“字体,如下所示:
input[type="button"]{
font-family: calibri;
}
我需要为最后一个字符使用"icomoon“字体,所以我的HTML应该是这样的:
<input type='button' value="Move to right <span class=icomoon>x</span>" />
但我认为这是不可能的,其他方式可以使用soms CSS伪代码,如::after或:first-letter,但我无法理解它们。
因此,问题是:是否可以使用css更改HTML按钮的最后一个字符?
发布于 2018-07-06 06:18:43
您可以只使用button元素,而不是在输入的值中插入span,
<style>
.button {
font-family: "OriginalFont";
}
.icomoon {
font-family: "icomoon"!important;
}
</style>
<button class="button">
Move to Right <span class="icomoon">x</span>
</button>
发布于 2018-07-06 06:08:28
您可以使用多个font-family
,然后考虑使用您要使用的图标的代码。
这是一个使用font-awesome
的想法
input[type="button"]{
font-family: calibri,'Font Awesome 5 Free';
font-size:20px;
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css">
<input type='button' value="Move to right " >
https://stackoverflow.com/questions/51200458
复制相似问题