Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 将引导图标添加到按钮_Html_Css_Twitter Bootstrap - Fatal编程技术网

Html 将引导图标添加到按钮

Html 将引导图标添加到按钮,html,css,twitter-bootstrap,Html,Css,Twitter Bootstrap,我有下面的代码,里面有文本按钮, 我想添加到按钮也从引导图标(在文本的左侧),我应该怎么做 图标为glypicon glypicon plus <div style="margin-top: 20px"> <p> @Html.ActionLink("New", "Create", null new { @class = "Button", @style = "float:right" }) </p> &l

我有下面的代码,里面有文本按钮, 我想添加到按钮也从引导图标(在文本的左侧),我应该怎么做

图标为glypicon glypicon plus

<div style="margin-top: 20px">
    <p>
        @Html.ActionLink("New", "Create",
        null new { @class = "Button", @style = "float:right" })
    </p>    
</div> 
<br />
<style type="text/css">
        .CreateButton {
            background: blue
;
            color: white;
            padding: 4px 10px 4px 10px;
            height: 30px;
            width: 60px;
        }


    </style>
<br />


@ActionLink(“新建”、“创建”,
空新{@class=“Button”,@style=“float:right”})


.CreateButton{ 背景:蓝色 ; 颜色:白色; 填充:4px10px 4px10px; 高度:30px; 宽度:60px; }

您发布的代码不允许我帮您做得更好,但让我们试试看

您需要在
.CreateButton:before{}
中复制
.glyphicon
类的所有属性,并使用要插入的图标的值添加-也在那里-
内容
属性。检查以查找所需图标的代码。您正在搜索的加号的值为“\2b”


由于这是公认的答案,因此我要补充的是,在某些情况下,最好使用用户缓存的答案

使用此选项插入图标

<i class="glyphicon glyphicon-plus"></i>

更新:
通过使用标记,您将自动在html中插入图标。有关更多信息,请查看此。另外,最好使用类。

您可以使用按钮标记而不是输入

<button type="submit" class="btn btn-primary">
  <i class="icon-user icon-white"></i> Sign in
</button>

登录

这看起来不太完整。代码顶部的这个类是怎么回事?@StenPelzer-我已经更新了帖子,请检查并告诉我是否遗漏了什么…你发布的代码不是html。这是什么?@omeinusch它的剃须刀,你可以在ASP.Net MVC中使用:)非常感谢,你是如何得到内容的:“\e001”;我应该如何放置Glypicon plus?
<button type="submit" class="btn btn-primary">
  <i class="icon-user icon-white"></i> Sign in
</button>