[英]CSS Awesome Font icon as submit button
I have a submit button like so: 我有一个提交按钮,如下所示:
<input type="submit" value="Submit" id="submitButton" />
and I also have this awesomefont icon 而且我也有这个很棒的字体图标
<i class="fa fa-search"></i>
I tried adding the class to the submit button, but that did not work. 我尝试将类添加到“提交”按钮,但这没有用。
Unless you are dead set on using <input>
, using a <button>
makes this quite a bit easier, but it is possible using the unicode version of search and prepending that with &#x
: 除非您习惯使用<input>
,否则使用<button>
会使这变得容易得多,但是可以使用unicode版本的search并在&#x
之前加上它:
#submitButton { font-family: FontAwesome; }
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"> <input type="submit" value="" id="submitButton"> <button id="submitButton"> <i class="fa fa-search"></i> </button>
The Unicode version of any Font Awesome icon can be found just below the icon on the Font Awesome site : 在Font Awesome网站上的图标下方可以找到任何Font Awesome图标的Unicode版本:
What about using a button? 使用按钮呢?
<button type="submit" value="Submit" id="submitButton" />
<i class="fa fa-search"></i> Submit
</button>
You could try the following - use button instead of input and the following code: 您可以尝试以下操作-使用按钮代替输入和以下代码:
<button type="submit" id="submitButton">
<i class="fa fa-search"></i> Submit
</button>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.