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!
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

banned banned
Courses Plus Student 11,243 PointsDiv block next to fixed div
How am I able to do this? Just like treehouse or youtube.
1 Answer

Tom Bedford
15,645 PointsHi Mark
You can add a fixed position to the sidebar, then add a margin to the content equal to the width of the sidebar.
Have a look at this demo.
banned banned
Courses Plus Student 11,243 Pointsbanned banned
Courses Plus Student 11,243 PointsThere are multiple ways to do this, including floats etc. What is a neat way to do this?
Tom Bedford
15,645 PointsTom Bedford
15,645 PointsYou can't float against a fixed element so you'd have to float against the opposite side. I think the demo I made for you is a pretty neat way of doing it.
Tom Bedford
15,645 PointsTom Bedford
15,645 PointsWell, you could float to the same side, but you'd still need the margin to offset it same correct distance from the fixed element.