使用font-awesome 在input框中增加一个图标

比如:
    在登录框增加一个用户头像 ,提示用户输入用户名

<html>
<link href="http://libs.baidu.com/fontawesome/4.4.0/css/font-awesome.min.css" rel="stylesheet"/>
<style>

.wrapper { position: relative; }
i.fa { position: absolute; top: 5px; left: 5px; }
.wrapper input { text-indent: 20px;}
</style>
<body>

<div class="wrapper">
    <i class="fa fa-user"></i>
    <input type="text" placeholder="username ">
</div>
<div class="wrapper">
    <i class="fa fa-key"></i>
    <input type="text" placeholder="password">
</div>
        </body>
</html>


猜你喜欢

转载自blog.csdn.net/robinhunan/article/details/75222654