带有FontAwesome5和Bootstrap4的图标占位符

时间:2018-02-11 02:05:47

标签: twitter-bootstrap bootstrap-4 font-awesome placeholder font-awesome-5

有没有人知道如何在Bootstrap4输入中使用FontAwesome5图标作为占位符?我已经看过以前版本的几种解决方案,但似乎都没有与最新版本一起使用。这是我到目前为止所得到的:

<input
  type="text"
  className="form-control"
  placeholder="&#xf002; Search"
  style={{
    fontFamily: 'FontAwesome, "Open Sans", Verdana, sans-serif',
    fontStyle: 'normal',
    fontWeight: 'normal',
    textDecoration: 'inherit'
  }}
/>

3 个答案:

答案 0 :(得分:0)

您无法添加图标和文字。 你可以尝试这个。

<input
  type="text"
  class="form-control"
  placeholder="&#xf002;"
  style="
     fontFamily:FontAwesome;
     fontStyle: normal;
     fontWeight: normal;
     textDecoration: inherit;
  "
/>

答案 1 :(得分:0)

&#13;
&#13;
input{
    font-family: FontAwesome;
    font-style: normal;
    font-weight: normal;
    text-decoration: inherit;
}
&#13;
<link href="//netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">

    <input type="text" placeholder="&#xF002;"/>
&#13;
&#13;
&#13;

答案 2 :(得分:0)

for a in l:
    score=0
    for b in range(0,length):
        if a[b]==t[b]:  <--------- #here you say the b'th value of the integer a

您应该在占位符中写上图标代码