我想在以下HTML代码中的占位符中添加字体真棒和文本,同时我想详细了解该过程:
<!DOCTYPE html>
<html>
<head>
<title>Student-login</title>
<link href='http://fonts.googleapis.com/css?family=Shadows+Into+Light' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="main.css">
<link rel="stylesheet" type="text/css" href="css/font-awesome.min.css">
</head>
<body>
<div class="body"></div>
<div class="main-form">
<h1>Student Login</h1>
<form class="login">
<input type="text" placeholder="*User name" name="username"></input><br>
<input type="password" placeholder="*Password" name="password"></input><br>
<input type="text" placeholder="*First name" name="first_name"></input><br>
<input type="text" placeholder="*Last name" name="last_name"></input><br>
<select name="gender">
<option value="">Select</option>
<option value="male">Male</option>
<option value="female">Female</option>
</select><br>
<input type="text" placeholder="*E-mail" name="email"></input><br>
<input type="text" placeholder="*Phone number" name="phone"></input><br>
<div class="button"><a href="index.html">Login</a></div>
<div class="button"><a href="#">Submit</a></div>
</form>
</div>
</body>
</html>
答案 0 :(得分:3)
要完成此操作,请使用FontAwesome作为字体,方法是将CSS font-family
设置为FontAwesome
并使用FontAwesome Unicode reference引用您想要的图标。
例如,要让fa-envelope
出现在占位符中,您可以使用以下内容:
<style type="text/css">
input {font-family:FontAwesome;}
</style>
<!-- use  which is the code for fa-envelope -->
<input type="text" placeholder=" E-mail" name="email" />