DEV Community

Discussion on: CSS Battle #3 - Push Button

Collapse
 
ductuanmdt profile image
DucTuanmdt

At the solution 3, the margin-collapsing mechanism is the reason leads to the issue you met, with overflow: hidden, it will prevent margin-collapsing, so it's working as expected.
I have other solution: just using a div tag and take advantage of it pseudo ::after to create the circle inside it:

<div></div>
<style>
  body {
    background: #6592CF;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  div {
    width: 300px;
    height: 150px;
    position: relative;
    background: #243D83;
  }
  div::after {
    content: '';
    width: 50px;
    height: 50px;
    position: absolute;
    background: #EEB850;
    border-radius: 50%;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 0 50px #243D83, 0 0 0 100px #6592CF;
  }
Enter fullscreen mode Exit fullscreen mode