简体   繁体   English

输入字段的屏幕中未显示图标

[英]icons are not shown in the screen for input field

I have the following code and I want to show a bootstrap icon instead of a button . 我有以下代码,我想显示一个引导图标而不是按钮。 Any idea what am I doing wrong? 知道我在做什么错吗?

 <input type="submit" value="Update" class="btn btn-default btn-update" />

I tried the following and its not working ,any idea how to solve it? 我尝试了以下方法,但它不起作用,您知道如何解决吗?

 <input type="submit" value="Update" class="glyphicon glyphicon-remove" />

and also like this: 也是这样的:

<input type="submit" value="Update" class="btn btn-default glyphicon glyphicon-remove" />

Per the Bootstrap docs : 根据Bootstrap文档

Don't mix with other components. 请勿与其他成分混合使用。 Icon classes cannot be directly combined with other components. 图标类不能直接与其他组件组合。 They should not be used along with other classes on the same element. 它们不应与同一元素上的其他类一起使用。 Instead, add a nested <span> and apply the icon classes to the <span> . 而是添加一个嵌套的<span>并将图标类应用于<span>

So try: 因此,请尝试:

<button type="submit" class="btn btn-default btn-lg">
<span class="glyphicon glyphicon-remove"></span>Update</button>

bootply example 引导示例

Since the input tag cannot hold any other html in it, the correct way to do this is to use the button tag: 由于input标签不能在其中包含其他任何html,因此正确的方法是使用button标签:

<button type="submit" class="btn btn-default"><i class="glyphicon glyphicon-remove"></i> Update</button>

Example in documentation 文档中的示例

Demo 演示版

CSS 的CSS

input[type=submit] {
        background: url(where_your_image_is);
        border: 0;
        display: block;
        height: _the_image_height;
        width: _the_image_width;
    }

OR 要么

 <input type="image" src="/yourImage" width ="" height="" border="0" />

first download the bootstrap folder : https://github.com/twbs/bootstrap/releases/download/v3.1.1/bootstrap-3.1.1-dist.zip 首先下载bootstrap文件夹: https : //github.com/twbs/bootstrap/releases/download/v3.1.1/bootstrap-3.1.1-dist.zip

extract it and upload the files in your server than add to your header : 解压缩它,然后将文件上传到服务器中,然后添加到标题中:

<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM