水平对齐文本,div和其他2个div

时间:2013-04-12 09:10:03

标签: css css3 css-float

我有什么:

 <div id="outerDiv" style="margin: 20px;">
                      <div id="innerDiv" style="float: left;">
                          <span>10002</span>

                          <div class="arrow-up" alt='some text' />
                          </br>
                            <div class="arrow-down"/>
                      </div>
                      <div><h3>Text</h3></div>
                      </br>
                      <span>Some plain text
            <br />
                      </span>
                  </div>

除了带有纯文本的span之外,outerdiv中的所有元素都必须对齐,并浮动到左边,但我无法弄清楚如何做到这一点。如果我移动的东西,其他一切开始飞遍整个页面。这样做的正确方法是什么?附上我想要实现的目标的图像:

enter image description here

1 个答案:

答案 0 :(得分:1)

使用这种结构可以帮助你

    <div id="outerDiv" style="margin: 20px;">
      <div id="innerDiv" style="float: left;">
        <span style="float:left; margin-top:15px;">10002</span>
        <div class=" " style="float:left;">
            <div class="arrow-up" alt='some text' /></div>
            <div class="arrow-down"/></div>
        </div>
        <h3 style="float:left;">Text</h3>
<div style="float:none; clear:both"></div>
      </div>  
      </br>
      <span>Some plain text</span>
    </div>
相关问题