Welcome to CSSBattle Challenges!
In this short article, I go through my solution for CSSBattle - #27 Lock Up challenge. Please refer to the code snippet below to get a better insight into my thought processes and the implementation detail.
Challenge:
Solution:
<div class="container">
<div class="red-circle"></div>
<div class="yellow-circle-borders"></div>
</div>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.container {
background: #E38F66;
width: 100vw;
height: 100vh;
position: relative;
}
.red-circle {
position: absolute;
width: 200px;
height: 200px;
border-radius: 50%;
background: #AA445F;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.yellow-circle-borders {
border: 30px solid #F7EC7D;
width: 140px;
height: 140px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) rotate(45deg);
border-radius: 50%;
border-left-color: transparent;
border-right-color: transparent;
}
</style>
Key Takeaway(s):
- using transparent border colors to hide the entirety of an element's shape
As always, I welcome any feedback or questions regarding the implementation detail of the challenge. Otherwise, I hope this was useful!
Top comments (0)