DEV Community

Cover image for CSSBattle | #25 Blossom
Nazmuz Shakib Pranto
Nazmuz Shakib Pranto

Posted on

CSSBattle | #25 Blossom

Welcome to CSSBattle Challenges!

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


Challenge:

Blossom Challenge


Solution:

<div class="container">
  <div class="lg-blossom left"></div>
  <div class="lg-blossom right"></div>
  <div class="sm-blossom left"></div>
  <div class="sm-blossom right"></div>
</div>

<style>
  * {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
  }
  .container {
    background: #998235;
    width: 100vw;
    height: 100vh;
    position: relative;
  }
  .lg-blossom {
    position: absolute;
    background: #1a4341;
    width: 100px;
    height: 80px;
    left: 50%;
    top: 50%;
  }
  .lg-blossom.left {
    border-top-left-radius: 50px;
    border-bottom-right-radius: 50px;
    transform: translate(calc(-50% - 50px), calc(-50% - 40px)) rotate(270deg);
  }
  .lg-blossom.right {
    border-top-right-radius: 50px;
    border-bottom-left-radius: 50px;
    transform: translate(calc(-50% + 50px), calc(-50% + 40px)) rotate(270deg);
  }
  .sm-blossom {
    position: absolute;
    background: #f3ac3c;
    width: 80px;
    height: 60px;
    left: 50%;
    top: 50%;
  }
  .sm-blossom.left {
    border-top-right-radius: 50px;
    border-bottom-left-radius: 50px;
    transform: translate(calc(-50% - 50px), calc(-50% + 60px));
  }
  .sm-blossom.right {
    border-top-left-radius: 50px;
    border-bottom-right-radius: 50px;
    transform: translate(calc(-50% + 50px), calc(-50% - 60px));
  }
</style>
Enter fullscreen mode Exit fullscreen mode

Key Takeaway(s):

  • using border-radius property to create blossom like shape
  • using both translate and rotate properties to control direction and placement of elements

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

Top comments (0)