2017-11-10 25 views
6

Làm thế nào để Đặt fontawesome trong trình giữ chỗ. Đây là mã của tôi:người dùng fontawesome trong trình giữ chỗ

<div class="form-group">   
    <input class="form-control" placeholder="username" id="inputdefault" type="text" /> 
    <input class="form-control" placeholder="password" id="inputdefault" type="text" /> 
</div> 
+0

Sự chỉnh sửa có https://stackoverflow.com/a/36808965/2375207 – nicolallias

Trả lời

3

Hãy thử cách này:

input { 
 
    padding:10px; 
 
\t font-family: FontAwesome; 
 
    
 
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/> 
 
<form role="form"> 
 
    <div class="form-group"> 
 
    <input type="text" class="form-control empty" id="iconified" placeholder="&#xf2ba"> 
 
    </div> 
 
</form>

+0

làm tôi cần phải nhập khẩu một cái gì đó – Ephraim

+0

nó chỉ hiển thị – Ephraim

+0

hộp @ Ephraim chỉ thư viện font chữ tuyệt vời của bạn, bạn cần phải bao gồm những gì được mong đợi. Ở đây tôi đã bao gồm phông chữ tuyệt vời CDN liên kết. Đó là nó. – nabanita

0

Bạn có thể thử này:

/* add the font to the input element*/ 
 

 
input { 
 
    font: normal normal normal 14px/1 FontAwesome; 
 
    font-size: inherit; 
 
    text-rendering: auto; 
 
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> 
 
<!-- add the code of the icon in the placeholder--> 
 
<input class="form-control" placeholder="&#xF002;" id="inputdefault" type="text">

Bạn có thể tìm mã here

0
<input type="text" class="form-control" placeholder="&#xF002;" id="inputdefault" style="font-family:Arial, FontAwesome" /> 

Một danh sách các mã hex có thể được tìm thấy trong số Font Awesome cheatsheet.

Các vấn đề liên quan