内联块内的显示块

时间:2015-11-21 21:25:15

标签: html css

我有两张图片,一张在左边,第二张在右边。当我尝试在它们之间的中间添加两个按钮时,右边的图片会显示在底部并且从左到右,我无法解决这个问题。有人可以建议我吗?元素不是那么大,它们可以轻松地站在一条线上。按钮应该是一个在另一个下面。有人可以建议我吗?

HTML

stringList: List[String] = List(1, 2, foo, 4)
scala> parsed: List[Double] = List(1.0, 2.0, 4.0)

CSS

game2048.prototype.ai = function (theState, depth, playerOne, alpha) {
    var state = this.clone(theState); 
    var moves = this.validMoves(state);

if (moves.length == 0) { // avoid game losing states
    return Number.MIN_VALUE;
}
if (depth == 0) { // base case.
    return this.utility(state);
}

if (playerOne) {
    for (var i = 0; i < moves.length; i++) {
        state.move(moves[i]); // check child state
        var temp = this.ai(state, depth - 1, false, alpha); // find the maximum utility for depth given
        if (alpha > temp) {
            break; // prune the children that we won't choose.
        } 
        alpha = Math.max(temp, alpha);
        state.reset();
    }
    return alpha;
} else { // perform expectation 
    var avg = 0;
    for (var i = 0; i < moves.length; i++) {
        state.addRandomTile();
        state.move(moves[i]);
        avg += this.ai(state, depth - 1, true, alpha);
        state.reset();
    } return avg / moves.length;
}
}

1 个答案:

答案 0 :(得分:1)

您可以包装两个button元素,然后将父包装元素display设置为inline-block

&#13;
&#13;
.button-wrapper,
.wings {
  display: inline-block;
}
.buttons {
  display: block;
  margin: 0.4em auto;
}
&#13;
<img src="//placehold.it/200" class="wings" id="leftWing" />
<div class="button-wrapper">
  <button class="buttons">Login</button>
  <button class="buttons">Register</button>
</div>
<img src="//placehold.it/200" class="wings" id="rightWing" />
&#13;
&#13;
&#13;