DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Nazmuz Shakib Pranto
Nazmuz Shakib Pranto

Posted on

CSSBattle | #22 Cloud

Welcome to CSSBattle Challenges!

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


Challenge:

Cloud Challenge


Solution:

<div class="container">
    <div class="left-circle circle bg-orange"></div>
    <div class="bottom-rect bg-orange"></div>
    <div class="right-circle circle bg-orange"></div>
</div>

<style>
  * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }
  .bg-orange {
    background: #D86F45;
  }
  .circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
  }
  .container {
    background: #F5D6B4;
    width: 100vw;
    height: 100vh;
    position: relative;
  }
  .left-circle, .bottom-rect, .right-circle {
    position: absolute;
    left: 50%;
    top: 50%;
  }
  .left-circle {
    transform: translate(-100px, -35px);
  }
  .bottom-rect {
    transform: translate(-75px, 15px);
    width: 175px;
    height: 50px;
    border-top-left-radius: 50px;
    border-top-right-radius: 50px;
    border-bottom-left-radius: 50px;
    border-bottom-right-radius: 50px;
  }
  .right-circle {
    transform: translate(-20px, -65px);
  }
</style>
Enter fullscreen mode Exit fullscreen mode

Key Takeaway(s):

  • breaking down a complicated shape into smaller, easily reproducible chunks
  • feel free to use position absolute to place elements relative to each other

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

Top comments (0)

πŸ€” Did you know?

Β 
πŸ“š You can adjust your experience level in Settings to see more relevant content.