Browse - Programming Tips - How can I put two divs on top of each other?

Date: 2017dec20
Language: css

Q.  How can I put two <div>s on top of each other?

A.  Use position:absolute like this.

<!DOCTYPE html> <meta charset='utf-8'> <style> .parent { position: relative; margin: 0px; padding: 0px; } .child { position: absolute; margin: 0px; padding: 0px; left: 0px; right: 0px; } </style> <div class='parent'> <div class='child'>ONE</div> <div class='child'>two</div> </div>