选项卡使中心对齐

时间:2014-04-27 21:40:08

标签: html css wordpress css3

This是我正在处理的WordPress主题标签,我正在尝试使标签居中对齐。我尝试在firebug中进行各种更改,但是对齐没有设置为准确居中,因为当我更改宽度时,对齐变得不对齐。请告诉我如何使标签居中对齐,如下图所示,无论宽度如何都应该有效:

/*Tab*/
.shortcode-tab-wrap .tabs {
    list-style: none;
    margin: 0;
}

.shortcode-tab .tabs li.tab {
    float: left;
    position: relative;
}

.shortcode-tab .tabs li.tab a {
    display: block;
    height: 45px;
    line-height: 45px;
    padding: 0 20px;
}

.shortcode-tab .tabs li.tab a .separate {
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 1px;
    display: block;
}

.shortcode-tab .tabs-content {
    padding: 20px;
}

.shortcode-left-tab {
    position: relative;
}

.shortcode-left-tab .tabs {
    position: absolute;
    top: 0;
    left: 2px;
    width: 200px;
}

.shortcode-left-tab .tabs li.tab {
    position: relative;
}

.shortcode-left-tab .tabs li.tab a {
    display: block;
    height: 45px;
    line-height: 45px;
    padding: 0 20px;
}

.shortcode-left-tab .tabs li.tab a .separate {
    position: absolute;
    top: 0;
    right: -1px;
    width: 1px;
    height: 45px;
    display: block;
}

.shortcode-left-tab .tabs-content {
    margin-left: 202px;
    padding: 20px;
}

1 个答案:

答案 0 :(得分:3)

.shortcode-tab {
    text-align: center; /* Center tabs */
}

.shortcode-tab .tabs {
    display: inline-block;
    vertical-align: bottom;
}

.shortcode-tab .tabs-content {
    text-align: left; /* Reset content text */
}