ASP.NET MVC5占位符超棒的字体 [英] ASP.NET MVC5 Font-awesome in placeholder

查看:95
本文介绍了ASP.NET MVC5占位符超棒的字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在登录页面的占位符中添加超棒的字体图标.到目前为止,这就是我所拥有的.我不知道如何在文本框中内部(作为占位符)

I am trying to add an font-awesome icon to my placeholder for the login page. This is what I have so far. I can't figure out how to get a font-awesome icon inside the textbox (as placeholder)

@Html.TextBoxFor(m => m.UserName, new { @class = "form-control login-input", placeholder = "Username or Email"})

我在此处问题中找到了如何添加占位符,但没有如何添加图标.

I found how to add a placeholder here question but not how to add the icon.

谢谢!

推荐答案

这应该对您有用:

@Html.TextBoxFor(m => m.Email, new { @class = "form-control login-input", placeholder = HttpUtility.HtmlDecode(" Username or Email"), style = "font-family:Arial, FontAwesome" })

需要使用真棒字体代码并添加字体系列,以及HtmlDecode代码.

Need to use the font awesome code and add the font family, as well as HtmlDecode the code.

这篇关于ASP.NET MVC5占位符超棒的字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆