【问题标题】:Twitter Bootstrap Tabs: How to: Increase spacing between tabsTwitter Bootstrap 选项卡:如何:增加选项卡之间的间距
【发布时间】:2013-06-03 22:07:07
【问题描述】:

我将 ui bootstrap 用于 angular(它使用 twitter bootstrap css)。我能够使选项卡居中,但我无法弄清楚如何在选项卡(右或左)之间添加间距(边距)。我尝试添加 margin-right: 100px;在 .nav-tabs > li 但那不起作用。

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;

        }

【问题讨论】:

    标签: twitter-bootstrap tabs margins


    【解决方案1】:

    设置margin-leftmargin-right.nav-tabs &gt; li &gt; a, .nav-pills &gt; li &gt; amargin-right 默认为 2px。

    b.e:

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

    【讨论】:

    • 您的代码可以工作,但是,我将每个选项卡(水平和垂直)的文本居中的代码覆盖了它。请参阅注释后的代码: /* 用于在选项卡中居中文本*/ 。想法?
    • 你能显示完整的 html 源代码吗?默认情况下,居中是通过填充完成的。所以试试:.tabbable ul li a{ line-height: 20px; padding-bottom: 8px; padding-top: 8px;}.tabbable ul &gt; li &gt; a{ padding-left: 12px; padding-right: 12px;
    【解决方案2】:

    将 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;
                }
    

    【讨论】:

      猜你喜欢
      • 2016-08-05
      • 1970-01-01
      • 1970-01-01
      • 2023-03-13
      • 2011-12-15
      • 1970-01-01
      • 2021-05-08
      • 1970-01-01
      • 2016-08-01
      相关资源
      最近更新 更多