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
Anthony Hind
5,715 Pointspositioning background images
Hi all,
I am wanting to position a banner image right to the top of my page but have the ability to overlay the navigation and also a logo but when I apply a background image to my HTML it just forces all the content down, the only way i am able to get my nav and other content to overlay is applying a negative margin but surely there can be a better way for example
html. top-img{ background-image: url() }
.logo{ marging-top: -450px; }
this isnt the actual code i'm just quickly showing what I have been trying to do
Hope this makes sense
Ant
3 Answers
Guil Hernandez
Treehouse TeacherHi Anthony Hind,
I give an example of how to do this in this video – at the 6:40 mark.
Hope this helps :)
James Barnett
39,199 PointsAnthony Hind - The trick is this is to position the logo absolute and use z-index on the nav, so it's rendered "on top" of the logo.
I made you a demo with codepen so you can see what I mean.
Anthony Hind
5,715 PointsThanks Guys that's just what I am trying to achieve, I am just working through the css background video's again now :)
James in your demo what would you suggest for aligning a logo at the very top centre similar to how subtle patterns website does it?
Thanks Guil, James