DEV Community

Cover image for CSSBattle | #2 Carrom
Nazmuz Shakib Pranto
Nazmuz Shakib Pranto

Posted on • Edited on

2 1

CSSBattle | #2 Carrom

Welcome to CSSBattle Challenges!

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


Challenge:

Carrom Challenge


Solution:

<div class="container">
  <div class="block top-left"></div>
  <div class="block top-right"></div>
  <div class="block bottom-left"></div>
  <div class="block bottom-right"></div>
</div>

<style>
  * {
    box-sizing: border-box;
    padding: 0;
    margin: 0;
  }
  .container {
    width: 100%;
    height: 100%;
    background: #62374e;
    position: relative;
  }
  .block {
    background: #fdc57b;
    width: 50px;
    height: 50px;
    position: absolute;
  }
  .top-left {
    top: 50px;
    left: 50px;
  }
  .top-right {
    top: 50px;
    right: 50px;
  }
  .bottom-left {
    bottom: 50px;
    left: 50px;
  }
  .bottom-right {
    bottom: 50px;
    right: 50px;
  }
</style>
Enter fullscreen mode Exit fullscreen mode

Key Takeaway(s):

  • using relative and absolute positioning to create relationships between parent and children elements

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

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (0)

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

👋 Kindness is contagious

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

Okay