Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial

Gunter Schroder
2,804 PointsCan't seem to add 3rd Div below two position:absolute Div's. Why?
Here is my HTML and CSS Code. Want to add a third div below the image but can't figure out how....
<!DOCTYPE HTML> <html> <head> <title>My Practice Site Two</title> <link rel="stylesheet" href="style2.css"> </head> <body> <header> <div class="background-img"></div> <div class="navbar"> <nav> <ul> <li><a href="">PROGRAM</a></li> <li><a href="">TICKETS</a></li> <li><a href="">PRACTICAL</a></li> <li><a href="">PARTNERS</a></li> <li><a href="">OVER NSJ</a></li> </ul> </nav> </div> </header> </body> </html> div.navbar { position: absolute; background: rgba(255, 255, 255, 0.7); top: 0; left: 0; right:0; padding: 15px; } nav li { display: inline-block; padding: 20px; }
nav a { color: white; text-decoration: none; font-family: TeeFranklinBook,sans-serif; font-weight: bold; } nav a:hover { color: #1560BD; } div.background-img { background-image: url('images/pops.JPG'); margin: 0; padding: 0; position: absolute; top: 0; left:0; right:0; bottom:0; }
2 Answers

Rick Gessner
43 PointsWhen you place divs on the page using absolute positioning, you take them out of the document flow. The third element (nav) doesn't interact geometrically with the other absolutely positioned elements. Alternatives are: 1) leave them all as div's and let layout place them accordingly, or 2) make them all absolutely positioned.

Gunter Schroder
2,804 PointsThanks!
Gunter Schroder
2,804 PointsGunter Schroder
2,804 Pointswhen I change either div to position: relative and refresh page screen goes blank