我正在努力解决这个问题的标题:根据标签内容的宽度使菜单标签居中。此外,我不确定为什么内容和菜单选项卡之间存在差距。
问题:为什么菜单不适应标签内容的宽度?
CSS jquery ui- tabs.css
<style>
#page-wrap { width: 675px; margin: auto; background:#FFF;}
.ui-tabs { zoom: 1; }
.ui-tabs .ui-tabs-nav { list-style: none; position: relative; overflow: hidden;
z-index: 1000; }
.ui-tabs .ui-tabs-nav li { position: relative; float: left;
border-bottom-width: 0 !important; background: #EBEBEB; }
.ui-tabs .ui-tabs-nav li a { float: left; text-decoration: none; padding: 5px 10px ; outline: medium none; font-weight: bold; font-size:11px; line-height:
35px;}
.ui-tabs .ui-tabs-nav
li.ui-tabs-selected { border-bottom-width: 0; background: #F9AE5C; color: #6A6A6A; border-top:1px solid #D4D4D4; border-left:1px solid #D4D4D4; border-right:1px solid #D4D4D4; }
.ui-tabs .ui-tabs-nav
li.ui-tabs-selected a, .ui-tabs
.ui-tabs-nav li.ui-state-disabled a,
.ui-tabs .ui-tabs-nav
li.ui-state-processing a { cursor: text; }
.ui-tabs .ui-tabs-nav li a,
.ui-tabs.ui-tabs-collapsible
.ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
.ui-tabs .ui-tabs-panel { padding: 20px; display: block; border-width: 0; background: none;
position: relative; min-height: 100px; border: 1px solid #D4D4D4; }
.ui-tabs .ui-tabs-hide { display: none !important; }
.pngIcon{ padding:0px 5px 0px 5px; vertical-align:top;}
a.mover { background: #900; padding: 6px 12px; position: absolute;
color: white; font-weight: bold; text-decoration: none;}
.next-tab { bottom: 0; right: 0; -moz-border-radius-topleft: 10px; -webkit-border-top-left-radius: 10px; }
.prev-tab { bottom: 0; left: 0; -moz-border-radius-topright: 10px; -webkit-border-top-right-radius: 10px; }
</style>
答案 0 :(得分:1)
嘿,现在习惯将border-top
添加到li
.ui-tabs .ui-tabs-nav li {
border-top: 1px solid transparent;
}
因为您曾经使用active class
上边框并在活动类中添加1px
现在,您可以在正常li
答案 1 :(得分:0)
以下是解决方案:http://jsfiddle.net/surendraVsingh/GDABm/1/
CSS更改:
.ui-tabs{
zoom: 1;
text-align:center; /* Add This */
}
.ui-tabs .ui-tabs-nav{
list-style: none;
position: relative;
overflow: hidden;
z-index: 1000;
display:inline-block; /* Add This */
}