DEV Community 👩‍💻👨‍💻

Cover image for CSSBattle | #3 Push Button
Nazmuz Shakib Pranto
Nazmuz Shakib Pranto

Posted on

CSSBattle | #3 Push Button

Welcome to CSSBattle Challenges!

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


Challenge:

Push Button Challenge


Solution:

<div class="container">
  <div class="outer-rect"></div>
  <div class="outer-transparent-circle"></div>
  <div class="inner-blue-bg-circle"></div>
  <div class="inner-gold-bg-circle"></div>
</div>

<style>
  * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }
  .container {
    width: 100%;
    height: 100%;
    background: #6592cf;
    position: relative;
  }
  .outer-rect {
    position: absolute;
    width: 300px;
    height: 150px;
    background: #243d83;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
  .outer-transparent-circle {
    position: absolute;
    width: 250px;
    height: 250px;
    border-radius: 50%;
    background: #6592cf;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
  .inner-blue-bg-circle {
    position: absolute;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: #243d83;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
  .inner-gold-bg-circle {
    position: absolute;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #eeb850;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
</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!

Top comments (2)

Collapse
ats1999 profile image
Rahul kumar

I have built a tool for content creators to generate open graph images for social media posts.

see -> og-image-client.vercel.app

Must check it out

Collapse
prakhart111 profile image
Prakhar Tandon

Hey
I am also having a CSS battle series.
This one I was able to do in 237 characters.
Have a look :
dev.to/prakhart111/cssbattle-targe...

🌚 Life is too short to browse without dark mode