In this article, I will solve a Eye of the Tiger CSS Challenge on CSS Battle. Let's look at the problem first.
Problem
We need to create the following container by using CSS Properties only:
Solution
So now look at the Solution and how we are going to achieve this.
HTML
<p c>
<p l>
<p r>
-
<p c>
: Center Circle -
<p l>
: Left Triangle -
<p r>
: Right Triangle
CSS
* {
margin: 0;
background: #0b2429;
}
body {
display: grid;
place-items: center;
}
p { position: absolute }
[c] {
width: 50;
height: 50;
border-radius: 1in;
border: 45px solid #f3ac3c;
box-shadow: 0 0 0 20px #0b2429,
0 0 0 30px #998235;
z-index: 1;
}
[l], [r] {
height: 160;
width: 82;
clip-path: polygon(0 50%, 100% 100%, 100% 0);
background: #998235;
}
[l] { left: 58 }
[r] {
right: 57;
transform: scalex(-1);
}
Note: In CSS Battle you can use
100
instead of100px
. You don't need to definepx
in CSS. However, if you are usingrem
or%
, you need to pass them separately. That's why in the above CSS code there are no units mostly. For more info visit hereMinify the code or CSS by using any CSS Minifier. It helps you to reduce the characters in the code which will increase the score.
Minified Version:
<p c><p l><p r><style>*{margin:0;background:#0B2429}body{display:grid;place-items:center}p{position:absolute}[c]{width:50;height:50;border-radius:1in;border:45px solid #F3AC3C;box-shadow:0 0 0 20px #0B2429,0 0 0 30px #998235;z-index:1}[l],[r]{height:160;width:82;clip-path:polygon(0 50%,100% 100%,100% 0);background:#998235}[l]{left:58}[r]{right:57;transform:scalex(-1)}
Wrapping up
There are many ways to solve this. You can share your approach in the comments. If you like this then don't forget to ❤️ it. And I'll see you in the next article. See you soon.
Top comments (2)
body{
margin: 0;
background: #0B2429;
}
div {
width: 200px;
height: 200px;
border-radius: 100%;
box-sizing: border-box;
border: 10px solid #998235;
margin: 50 100;
box-shadow: inset 0 0 0 20px #0B2429 ,inset 0 0 0 65px #F3AC3C,inset 0 0 0 100px #0B2429;
}
div:after, div:before{
content: '';
height: 0;
width: 0;
position: absolute;
z-index: -1;
top: 80.5;
border-top: 70px solid transparent;
border-bottom: 70px solid transparent;
}
div:after{
border-left: 70px solid #998235;
left: 272;
}
div:before{
border-right: 70px solid #998235;
right: 272
}
I tryed to do without clip-path, and with just one div, i almost hit it
Using pseudo classes is also good however its 99.9% match but Nice try.