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

CSS

Position absolute

Hi I'm having an issue with my html document. I used centered my image using position: absolute but it is bleeding over on top of my text. Please help me find a solution to remove this problem. Thank you.

Cheo R
Cheo R
37,150 Points

Can you post your code.

1 Answer

Leanne Werner
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Leanne Werner
Front End Web Development Techdegree Graduate 16,847 Points

Remember that position absolute works with position relative to layout your content. I would double check that you are calling position relative on the correct parent element of your image. If there is no position relative called in your CSS, then your image will be relative to the body of your HTML by default, which can cause unexpected behaviors. Also, if you are having issues with content appearing on top of other content, you can check to make sure your z-index values are what you would like. If you don't have any z-index values set (or elements have the same z-index) AND two or more elements are occupying the same space, then the element that is listed last in your HTML markup will appear 'on top' of the other elements by default. I found MDN documentation to really help me understand CSS positioning here's the link: https://developer.mozilla.org/en-US/docs/Web/CSS/position Hope this helps!