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

How to Overlap Shapes?

Hi

I am trying to build a basic contact card in HTML & CSS, but for now I am just stripping it back to the basic 3 containers I will need to house the content. For now I just want to focus on how to position the avatar container to sit over the top of where the masthead and about container meet and for it to be exactly horizontally center across that diving line.

I have managed to center the avatar circle horizontally using margin: auto; but not vertically which is what I am stuggaling with.

see my code below..

<div class="container">
  <div class="wrap">

    <div class="hero">

    </div>

    <div class="about">
      <div class="avatar">

      </div>
    </div>


  </div>
</div>
.container {
  width: 100%;
  background-color: grey;
}

.wrap {margin: 0 auto; width: 90%;}

.hero {
    width: 100%;
    height: 700px;
    background: red;

}
.about {
    width: 100%;
    height: 700px;
    background: navy;
    margin: 0 auto;
}

.avatar {
    width: 150px;
    height: 150px;
    background-color: lime;
    border-radius: 50%;
    margin-left: auto;
    margin-right: auto;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 10%;
}