-1

I am attempting to center the .neck under the .head. I tried using margins. however that moved both .head, and .neck when I specified margin right 75px. How can I move the .neck independently so that it is centered under .head. I am attempting to teach myself CSS

 .android {
display:flex;
justify-content: center;}
.head{
      
  width: 15%;
  height: 60px;
  background: rgb(62, 226, 62);
  border-radius: 50% / 10%; }
.neck 
    {
  width: 50px;
  height: 70px;
  /* border-radius: horziontal values / vertical values */
  border-radius: 50px 50px / 20px 20px;
  background: rgb(39, 189, 47);
  justify-content: center;
  margin-top: 75px;}

I attempted to use flex box column, and margin right 75px. However this did not work

starball
  • 20,030
  • 7
  • 43
  • 238

1 Answers1

0

If the .neck is nested in .head then setting the position absolute should work fine like this.

.neck{
position: absolute;
left: 50%;
margin: auto;

}