将div粘贴到页面底部

时间:2010-05-06 09:52:05

标签: css html

我有位置绝对的div,我想把另一个div放在下面 这两个div有不同的宽度 上面的div是绝对位置并且居中。应位于底部的div具有100%的宽度 怎么做?
谢谢!

5 个答案:

答案 0 :(得分:2)

  • 制作一个包含
  • div
  • 使用float:right

例如

div#p8015buttons {
    position:absolute;
    bottom:0.5em;
    right:0.5em;
    width:90px;
}
div.p8015 {
    float:right;
    margin:1px;
}

答案 1 :(得分:0)

将两个DIV包裹在第三个DIV中并将其定位为绝对值而不是原始值。

答案 2 :(得分:0)

未经测试,但应该这样做。

HTML:

<div class="wrapper">
      <div class="one">
         Content
      </div>
      <div class="two">
         More content
      </div>
    </div>

CSS:

    .wrapper
    {
      position:absolute;
      width: 500px; 
      height: 400px;/*whatever you want*/
      }

    .one,
    .two
    {
      position:relative; /*or static*/
    }

希望有所帮助:)

答案 3 :(得分:0)

测试 HTML MARKUP

<div class="wrapper">
<div class="left-ontent>
</div>
<div class="right-ontent>
</div>
</div>

CSS

.wrapper{width:980px;margin:0 auto;position:absolute;}
.left-content{float:left;width:630px;}
.right-content{float:right;width:320px;}

答案 4 :(得分:0)

尝试这个,然后你可以将风格移动到你的CSS

<div style="width:500px; margin: auto; height:200px; background-color:black;">
</div>
<div style="width:100%; height:200px; background-color:green;">
</div>