Html 引导CSS边距0自动不居中
我目前正在使用Bootstrap3。嗯,我不能使按钮组居中 HTMLHtml 引导CSS边距0自动不居中,html,css,twitter-bootstrap,Html,Css,Twitter Bootstrap,我目前正在使用Bootstrap3。嗯,我不能使按钮组居中 HTML <div class="container" style="margin-top:100px;"> <div class="btn-group" style="margin:0 auto"> <button type="button" class="btn btn-default" >Left</button> <button
<div class="container" style="margin-top:100px;">
<div class="btn-group" style="margin:0 auto">
<button type="button" class="btn btn-default" >Left</button>
<button type="button" class="btn btn-default" >Middle</button>
<button type="button" class="btn btn-default" >Right</button>
</div>
</div>
左边
中间的
赖特
我怎样才能解决这个问题呢?编辑:吉列莫·曼西拉的答案更好。相同的技术,但更好地利用现有的引导类。 您可以在
.container
上设置文本对齐:居中。不需要页边距:0自动
.container {
text-align: center;
margin-top: 100px;
}
您不需要使用内联样式,只需应用bootstrap中已包含的类“文本中心”bootstrap 4 use
使用文本中心
或mx自动
或容器流体
您可以使用此hack文本中心
(这不仅适用于文本)
或者使用准确的boostrap4类mx auto
范例
class=“text center”
或class=“mx auto”
在上下文中
或
尽量不要使用内联样式(坏习惯)
此处引用:
文本中心
=>
mx自动
=>