DEV Community

Cover image for CSSBattle | #32 Band-aid
Nazmuz Shakib Pranto
Nazmuz Shakib Pranto

Posted on

CSSBattle | #32 Band-aid

Welcome to CSSBattle Challenges!

In this short article, I review my solution for CSSBattle - #32 Band-aid challenge. Please refer to the code snippet below for better insight into my thought processes and the implementation details.


Challenge:

Band-aid Challenge


Solution:

<div class="container">
  <div class="layer-1"></div>
  <div class="layer-2"></div>
  <div class="layer-square"></div>
</div>

<style>
  body, * {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
  }
  .container {
    width: 100vw;
    height: 100vh;
    position: relative;
  }
  .layer-1 {
    width: 50px;
    height: 200px;
    background: #F3AC3C;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
  }
  .layer-2 {
    width: 200px;
    height: 50px;
    background: #A3A368;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
  }
  .layer-square {
    width: 50px;
    height: 50px;
    background: #FBE18C;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg)
  }
</style>
Enter fullscreen mode Exit fullscreen mode

Key Takeaway(s):

  • use multiple transform attributes as translate and rotate to shift and rotate elements

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

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

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

Okay