DEV Community

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

Posted on

2 1

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!

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay