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

button overlapping flexbox

Hello there. I currently have a div with 2 images that serve as a background. I am using flexbox to place those images side by side, but I want to place a button on top of the 2 pictures as an enter button. I've tried a few things, but it will only display the text either at the bottom or to the right of the pictures. How can I accomplish this? Here is my code

HTML:

<div class="background"> <img id="right" src="https://i.imgsafe.org/2ab9fa8aa5.jpg"> <img id="left"src="https://i.imgsafe.org/2ab9f1b81c.jpg"> </div> <div> <span id="enter">ENTER</span> </div>

CSS: .background{ display:flex;

} img{ max-width:50%; height:auto;

}

3 Answers

Try using this:

#enter {
position: absolute;
top: 50%;
left: 50%;
}

After that you can change the top and left values however you want!

Thank you! worked like a charm I've been banging my head.. lol

You're welcomed!