Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/450.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 修改字体的css_Javascript_Jquery_Html_Css_Fonts - Fatal编程技术网

Javascript 修改字体的css

Javascript 修改字体的css,javascript,jquery,html,css,fonts,Javascript,Jquery,Html,Css,Fonts,我使用这个文件在我的输入按钮上实现图标 采取另一种方法,而不是将字体直接指定给输入,将其指定为 input[type="button"]:before{ content: 'fontawesomeCode', font-family: FontAwesome } 将预付款文本保留在按钮上,并将其与填充对齐。采取另一种方法,而不是将字体直接指定给输入,将其指定为 input[type="button"]:before{ content: 'fontawesomeCode', font-fami

我使用这个文件在我的输入按钮上实现图标


采取另一种方法,而不是将字体直接指定给输入,将其指定为

input[type="button"]:before{ content: 'fontawesomeCode', font-family: FontAwesome }

将预付款文本保留在按钮上,并将其与填充对齐。

采取另一种方法,而不是将字体直接指定给输入,将其指定为

input[type="button"]:before{ content: 'fontawesomeCode', font-family: FontAwesome }

将预付款文本保留在按钮上,并将其与填充对齐。

您在错误的位置应用了字体系列。更改字体族时,它将加载该族的该部分以及所有相关字符映射。因此,如果你想添加图标,只需使用官方文档中给出的图标即可。另外,由于
无法在其中包含任何html,因此不可能在其中包含文本和图标

我建议使用
。 参考我的意见

HTML
您在错误的位置应用字体系列。更改字体族时,它将加载该族的该部分以及所有相关字符映射。因此,如果你想添加图标,只需使用官方文档中给出的图标即可。另外,由于
无法在其中包含任何html,因此不可能在其中包含文本和图标

我建议使用
。 参考我的意见

HTML 您可以使用
标记,在将使用默认字体的位置添加

<button type="button" name="button" class="submitter" onClick="location.href='../test.htm'">
  &#xf09d;
  <strong>Pre-payment</strong>
</button>
您可以使用
标记,在将使用默认字体的位置添加

<button type="button" name="button" class="submitter" onClick="location.href='../test.htm'">
  &#xf09d;
  <strong>Pre-payment</strong>
</button>

我不确定是否可以使用输入元素来完成。但也可以使用按钮。以下是两个例子:

1) 在图标的按钮内使用单独的元素(如i或span等)

<button type="button">
  <i class="fa fa-credit-card" aria-hidden="true"></i> Pre-payment
</button>

预付款
2) 使用伪元素,允许您通过css对图标进行必要的更改

<button type="button" class="submitter" onClick="location.href='../test.htm'"/>Pre-payment</button>

<style>
button.submitter:before {
    font-family: FontAwesome;
    content:'\f09d';
    margin-right:4px;
}
</style>
预付款
按钮。提交者:之前{
字体系列:Fontsome;
内容:'\f09d';
保证金权利:4px;
}

我不确定是否可以使用输入元素来完成。但也可以使用按钮。以下是两个例子:

1) 在图标的按钮内使用单独的元素(如i或span等)

<button type="button">
  <i class="fa fa-credit-card" aria-hidden="true"></i> Pre-payment
</button>

预付款
2) 使用伪元素,允许您通过css对图标进行必要的更改

<button type="button" class="submitter" onClick="location.href='../test.htm'"/>Pre-payment</button>

<style>
button.submitter:before {
    font-family: FontAwesome;
    content:'\f09d';
    margin-right:4px;
}
</style>
预付款
按钮。提交者:之前{
字体系列:Fontsome;
内容:'\f09d';
保证金权利:4px;
}

试着这样做,你想包括你自己的字体系列并与fontawesome合并吗?@Sagar yes基本上使用字体系列:tahoma、helvetica、sans serif;除了字体很棒,iEntry需要字体很棒等等,你想加入你自己的字体系列并与字体很棒合并吗?@Sagar yes基本上使用字体系列:tahoma、helvetica、sans serif;我会尝试一下,然后再给你回复,如果输入了正确的内容代码,应该可以工作,比如tihs:.element:before{content:“\f000”;font-family:FontAwesome;}谢谢,我会试一试,然后再联系你。不过,如果输入了内容的正确代码,这应该会起作用,比如tihs:.element:before{content:“\f000”;font-family:FontAwesome;}我试过了,但我的图标消失了,只剩下文本了:(我试过了,但我的图标消失了,只留下了文字。)(你是天才…我花了好几个小时在这上面…你的第一个解决方案对我非常有效…谢谢。你是天才…我花了好几个小时在这上面…你的第一个解决方案对我非常有效…谢谢。