Twitter Bootstrap选项卡:如何增加选项卡之间的间距

3
我将为您提供翻译。这是关于编程的问题,涉及到使用angular和Twitter Bootstrap CSS中的UI bootstrap来创建标签页。作者成功实现了标签居中显示,但无法在标签之间添加间距(右侧或左侧)。作者尝试在“.nav-tabs > li”中添加“margin-right: 100px;”,但没有效果。请注意保留HTML标记。
<html>
    <body>

               <tabbed-Panel class="bottomTabPanel">
            <!--<div data-fade="1" ngModel="activeTab" bs-Tabs>-->
            <tabs>
                <pane ng-repeat="pane in panes" heading="{{pane.title}}"  active="pane.active">
                    <div ng-include src="activeContent()"></div>
                </pane>
            </tabs>
            <!--</div>-->
        </tabbed-Panel>
            </div
    </body>
</html>

CSS
.bottomTabPanel{

    position:absolute;
    bottom:-12px;
    display:block;  
    background-color:#666666;
    padding-left: 75px;
    padding-right: 75px;
}
    /*Bottom tab panel style: */
    .nav-tabs>li>a {
        height:73px;
        width: 131px;
        border: 1px solid transparent;
        -webkit-border-radius: 0px 0px 0 0;
        -moz-border-radius: 0px 0px 0 0;
        border-radius: 0px 0px 0 0;
        color: #5261ac;
        font-size: 19px;
        font-weight:bold;
        background-color:#c2c8e4;


     }

     .nav-tabs>.active>a, .nav-tabs>.active {
        color: #ffffff;
        cursor: default;
        background-color:#ed174f;
        border:none;
     }
      /* center tabs in container */
     .nav-tabs > li {
        float:none;
        display:inline-block;
        margin-right: 100px;
     }
     .nav-tabs {
        text-align:center;
     }

      /* for centering text in the tab*/
     .tabbable ul {
            display:table-row;
        }
        .tabbable ul li
        {
            display: table-cell;
            list-style-type: none;
            vertical-align: middle;
            /*margin left & right here fixed the issue! */
            margin-right: 16px;
            margin-left: 16px;
        }
        .tabbable ul li a {
            display:table-cell;
            vertical-align: middle;
            text-align:center;

        }
2个回答

10

设置 .nav-tabs > li > a, .nav-pills > li > amargin-leftmargin-right。默认情况下,margin-right 为2px。

b.e:

    .nav-tabs > li > a, .nav-pills > li > a {margin-left:25px;margin-right:27px;}

你的代码可以工作,但是我的代码用于将每个选项卡中的文本居中(水平和垂直方向),它会覆盖你的代码。请看注释后面的代码:/* 用于选项卡中文本居中 */。你有什么想法吗? - Mike6679
你能显示完整的HTML源代码吗?默认情况下,居中对齐是通过填充完成的。所以尝试:.tabbable ul li a{ line-height: 20px; padding-bottom: 8px; padding-top: 8px;} 和 `.tabbable ul > li > a{padding-left: 12px; padding-right: 12px;` - Bass Jobsen

0

将 margin-right 和 margin-left 添加到 .tabbable ul li 中,创建了我需要的边距。感谢 Bass Jobsen 指引我正确的方向。

.tabbable ul li
            {
                display: table-cell;
                list-style-type: none;
                vertical-align: middle;
                /*margin left & right here fixed the issue! */
                margin-right: 16px;
                margin-left: 16px;
            }

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接