相关疑难解决方法(0)

将Bootstrap Glyphicon添加到输入框

如何将glyphicon添加到文本类型输入框?例如,我想在用户名输入中使用'icon-user',如下所示:

在此输入图像描述

css twitter-bootstrap glyphicons

337
推荐指数
9
解决办法
61万
查看次数

文本输入元素内的字体真棒图标

我试图在用户名输入字段中插入用户图标.

我已经尝试过类似问题的解决方案之一,background-image因为Font Awesome是一种字体,因此 知道属性不起作用.

以下是我的方法,我无法显示图标.

.wrapper input[type="text"] {
    position: relative;
}

.wrapper input[type="text"]:before {
    font-family: 'FontAwesome';
    position: absolute;
    top: 0px;
    left: -5px;
    content: "\f007";
}
Run Code Online (Sandbox Code Playgroud)

我在默认字体awesome css中声明了字体,所以我不确定上面添加font-family是否是正确的方法.

 @font-face {
     font-family: 'FontAwesome';
     src: url('../Font/fontawesome-webfont.eot?v=3.2.1');
     src: url('../Font/fontawesome-webfont.eot?#iefix&v=3.2.1') format('embedded-opentype'), url('../Font/fontawesome-webfont.woff?v=3.2.1') format('woff'), url('../Font/fontawesome-webfont.ttf?v=3.2.1') format('truetype'), url('../Font/fontawesome-webfont.svg#fontawesomeregular?v=3.2.1') format('svg');
 }
Run Code Online (Sandbox Code Playgroud)

html css fonts font-awesome

125
推荐指数
8
解决办法
31万
查看次数

在占位符中使用Font Awesome图标

是否可以在占位符中使用Font Awesome Icon?我读了占位符中不允许HTML的地方.有解决方法吗?

placeholder="<i class='icon-search'></i>"
Run Code Online (Sandbox Code Playgroud)

placeholder font-awesome

96
推荐指数
9
解决办法
16万
查看次数