提问者:小点点

字体超赞图标不在html中显示


我有一个html的联系表单,我给了输入字段的字体很棒的图标,oce如下:

null

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">

<div class="wrap-input100">
						<input class="input100" type="number" name="pass" placeholder="Mobile Number">
						<span class="focus-input100" data-placeholder="&#xf095;"></span>
					</div>

					<div class="wrap-input100">
						<input class="input100" type="text" name="question" placeholder="Your Query">
						<span class="focus-input100" data-placeholder="&#xf128;"></span>
					</div>

null

但是字体awesome似乎不起作用,有人能告诉我这里有什么问题吗


共3个答案

匿名用户

使用font-awesome时,不需要添加数据占位符。 你应该使用如下所示的类字体:

<span class="focus-input100 fa fa-phone"></span>
<span class="focus-input100 fa fa-question"></span>

null

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">

<div class="wrap-input100">
    <input class="input100" type="number" name="pass" placeholder="Mobile Number">
    <span class="focus-input100 fa fa-phone"></span>
</div>

<div class="wrap-input100">
    <input class="input100" type="text" name="question" placeholder="Your Query">
    <span class="focus-input100 fa fa-question"></span>
</div>

匿名用户

要使用字体出色的图标,请不要使用data-placeholder。 字体Awesome是一种将字形转换为图标的字体。 因此,您的固定代码是:

null

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">

<div class="wrap-input100">
  <input class="input100" type="number" name="pass" placeholder="Mobile Number">
  <span class="focus-input100 fa">&#xf095;</span>
</div>

<div class="wrap-input100">
  <input class="input100" type="text" name="question" placeholder="Your Query">
  <span class="focus-input100 fa">&#xf128;</span>
</div>

匿名用户

使用字体awesome在输入占位符,你可以使用这个代码。

null

    input {
    font-family: FontAwesome;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">

   <div class="wrap-input100">
						<input class="input100" type="number" name="pass" placeholder="&#xf095; Mobile Number ">
					</div>

					<div class="wrap-input100">
						<input class="input100" type="text" name="question" placeholder="&#xf128; Your Query" >
                    </div>