导航栏中按钮之间的 Bootstrap CSS 空间

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18065062/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 23:48:43  来源:igfitidea点击:

Bootstrap CSS space between buttons in navbar

csstwitter-bootstrap

提问by dynamitem

How can I make space between buttons in navbar? I usually do that with  but it doesn't work now. Here's an JSfiddle of how it looks:

如何在导航栏中的按钮之间留出空间?我通常这样做, 但现在不起作用。这是一个关于它的外观的 JSfiddle:

http://jsfiddle.net/W6hEa/

http://jsfiddle.net/W6hEa/

回答by Ritabrata Gautam

you may try margin-left

你可以试试 margin-left

here is the code

这是代码

.btn{
margin-left:10px;
}

here is the example:: FIDDLE

这是例子::: FIDDLE

回答by Jens A. Koch

Copy & paste this to your style.cssand assign it as class attribute:

将其复制并粘贴到您的style.css并将其分配为类属性:

.btn-margin-left {
    margin-left: 2px;
}
.btn-margin-right {
    margin-right: 2px;
}

Usage

用法

<a href="URL" class="btn btn-default btn-sm btn-margin-left">Link</a>

<button type="button" class="btn btn-default btn-sm btn-margin-left">Button</button>