DEV Community

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

Posted on

2 2

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!

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 (3)

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...

Collapse
 
harindradev profile image
Harindra Masna

My solution 209 characters

<p><p a><style>*{background:#6592CF;margin:0}p{position:absolute;inset:75px 50px; background:#243D83}[a]{inset:75px 125px;background:#EEB850;border-radius:50%;border:50px solid#243D83;outline:50px solid#6592CF
Enter fullscreen mode Exit fullscreen mode

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