DEV Community

Cover image for CSSBattle | #26 Smiley
Nazmuz Shakib Pranto
Nazmuz Shakib Pranto

Posted on

CSSBattle | #26 Smiley

Welcome to CSSBattle Challenges!

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


Challenge:

Smiley Challenge


Solution:

<div class="container">
  <div class="arc left"></div>
  <div class="arc mid"></div>
  <div class="arc right"></div>
</div>

<style>
  * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }
  .container {
    background: #6592CF;
    width: 100vw;
    height: 100vh;
    position: relative;
  }
  .arc {
    position: absolute;
    width: 120px;
    height: 60px;
    border: 20px solid #060F55;
    border-top-left-radius: 100px;
    border-top-right-radius: 100px;
    border-bottom: 0;
    top: 50%;
    left: 50%;
  }
  .left {
    transform: translate(calc(-50% - 100px), calc(-50% - 80px));
  }
  .right {
    transform: translate(calc(-50% + 100px), calc(-50% - 80px));
  }
  .mid {
    transform: translate(-50%, calc(-50% + 80px)) rotate(-180deg);
  }
</style>
Enter fullscreen mode Exit fullscreen mode

Key Takeaway(s):

  • using arc-like shapes with border properties and transparent background

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

Latest comments (0)