DEV Community 👩‍💻👨‍💻

Cover image for CSSBattle | #10 Cloaked Spirits
Nazmuz Shakib Pranto
Nazmuz Shakib Pranto

Posted on

CSSBattle | #10 Cloaked Spirits

Welcome to CSSBattle Challenges!

In this short article, I go through my solution for CSSBattle - #10 Cloaked Spirits challenge. Please refer to the code snippet below to get a better insight into my thought processes and the implementation detail.


Challenge:

Cloaked Spirits Challenge


Solution:

<div class="container">
  <div class="parent">
    <div class="child left">
      <div class="outer-ring">
        <div class="inner-ring"></div>
      </div>
    </div>
    <div class="child center">
      <div class="outer-ring">
        <div class="inner-ring"></div>
      </div>
    </div>
    <div class="child right">
      <div class="outer-ring">
        <div class="inner-ring"></div>
      </div>
    </div>
  </div>
</div>

<style>
  * {
    box-sizing: border-box;
    padding: 0;
    margin: 0;
  }
  .container {
    width: 100%;
    height: 100%;
    background: #62306D;
    display: flex;
    justify-content: center;
    align-items: end;
  }
  .parent {
    display: flex;
    align-items: end
  }
  .child {
    background: #F7EC7D;
    width: 100px;
    border-top-left-radius: 100px;
    border-top-right-radius: 100px;
  }
  .left, .right {
    height: 150px;
  }
  .center {
    height: 250px;
  }
  .left, 
  .center, 
  .right {
    display: flex;
    flex-direction: column;
  }
  .left .outer-ring,
  .center .outer-ring,
  .right .outer-ring {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100px;
    height: 100px;
    border-radius: 50%;
  }
  .left .inner-ring,
  .center .inner-ring,
  .right .inner-ring {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
  }
  .left .outer-ring,
  .right .outer-ring {
    background: #AA445F;
  }
  .left .inner-ring,
  .right .inner-ring {
    background: #E38F66;
  }
  .center .outer-ring {
    background: #E38F66;
  }
  .center .inner-ring {
    background: #AA445F;
  }
</style>
Enter fullscreen mode Exit fullscreen mode

Key Takeaway(s):

  • centering elements vertically and horizontally using flexbox layout

As always, I welcome any feedback or questions regarding the implementation detail of the challenge. Otherwise, I hope this was useful!

Top comments (0)

🌚 Life is too short to browse without dark mode