Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Placing two divs one below another

Tags:

html

css

I am having some problems with placing two divs one below another.

I tried out some solutions found in Stackoverflow like below.
But Nothing seems to be working.

Code:

#wrapper {
  position: absolute;
}

#up {
  position: absolute;
  float: left;
}

#down {
  position: absolute;
  float: left;
  clear: left;
}
<div id="wrapper">
  <div id="up"></div>
  <div id="down"></div>
</div>

Here's My Attempt,

Fiddle

Helps would be appreciated.

like image 217
Rajaprabhu Aravindasamy Avatar asked Dec 06 '12 18:12

Rajaprabhu Aravindasamy


2 Answers

Remove the CSS. DIV tags are block elements and would naturally flow down the page. You are floating them which would cause them to be displayed side by side.

Especially remove the "float" attributes.

like image 52
CM Kanode Avatar answered Nov 13 '22 00:11

CM Kanode


That's how DIV's work by default, just remove your css. See a working example here: jsfiddle

<div id="wrapper">
<div id="up"></div>
<div id="down"></div>
</div>​
like image 1
Magicmarkker Avatar answered Nov 12 '22 22:11

Magicmarkker