Html 提交按钮上带有文本的 Bootstrap 刷新图标
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21647700/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Bootstrap refresh icon with text on Submit button
提问by AbuMariam
I would like to have a "Refresh" button on my page. For that I decided to use the bootstrap refresh-icon style. The icon appears on my button but it does not leave much room for the text "Refresh". Here is the code and Fiddle...
我想在我的页面上有一个“刷新”按钮。为此,我决定使用引导程序刷新图标样式。图标出现在我的按钮上,但它没有为文本“刷新”留下太多空间。这是代码和小提琴......
<input class="icon-refresh" type="submit" value="Refresh" name="Test"> </input>
http://jsfiddle.net/jjaleel/kVHbV/339/
http://jsfiddle.net/jjaleel/kVHbV/339/
Anyone have any suggestions on how I can expand the button width so it shows both the refresh icon and the text?
任何人都对如何扩展按钮宽度以便同时显示刷新图标和文本有任何建议?
Thanks.
谢谢。
回答by Dale
回答by Maxime Lorant
回答by Faust
Put the refresh icon in a span inside a button:
将刷新图标放在按钮内的跨度中:
<button type="submit" value="Refresh" name="Test"><span class="icon-refresh"></span> </button>
update(based on OP comment)
更新(基于 OP 评论)
Without being able to change the markup at all, this is tough. To get rid of the "Refresh" text, set the text-color to transparent
. For sizing, set display to inline-block and fix height and width to 20px.
根本无法更改标记,这很困难。要摆脱“刷新”文本,请将文本颜色设置为transparent
. 对于调整大小,将 display 设置为 inline-block 并将高度和宽度固定为 20px。
input{
display:inline-block;
color:transparent;
height:20px !important;
width:20px !important;
}