Insert a div at the bottom of the page

I have a div with an absolute position and I want to put another div under.
Two divs have different widths.
The top div is in absolute position and centered. The diva, which should be below, is 100% wide.
How to do it? Thank!

+3
source share
5 answers
  • make one divthat contains like
  • use float:right

Example:

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

Wrap both divs in the third and place this absolute instead of the original.

0
source

, .

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*/
    }

, :)

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;}
0

, css

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

Source: https://habr.com/ru/post/1744313/


All Articles