为什么跨度不在这个div中?

时间:2013-03-13 18:47:07

标签: html css

我在一个范围内有2个跨度,彼此居中,类inside_span up和inside_span down,它们对齐到pulse_result_format span的左边,我尝试了margin:0 auto在脉冲结果格式范围内,不work和display:inline-block;

HTML:

<div class="pulse_votes_container thumb1">
    <span class="pulse_vote_buttons">
    </span>
    <span class="pulse_result_format">
        <span class='inside_span up'>{up}</span>
        <span class='inside_span down'>{down}</span>
    </span>
</div>

CSS:

.inside_span {

    display: inline-block;
    width:40%;
    border-radius: 3px 3px 3px 3px;
    margin: 10% auto 0px 0px;
    float:left;
}

.down {

    background-color:#FF6E25;
}

.up {

    background-color: rgb(70, 136, 71);
}

.pulse_result_format {

    display: inline-block;
    float: left;
    width: 100%;
    text-align: center;

    font-weight: bold;
    color: rgb(255, 255, 255);
    text-shadow: 0px -1px 0px rgba(0, 0, 0, 0.25);
    white-space: nowrap;
    vertical-align: baseline;
}

.pulse_votes_container {

    width:100%;
    height:100%;
    display: inline-block;
    text-align: center;
}

1 个答案:

答案 0 :(得分:0)

float:left

中删除.inside_span
.inside_span {
    display: inline-block;
    width:40%;
    border-radius: 3px 3px 3px 3px;
    margin: 10% auto 0px 0px;
}

<强> jsFiddle example