CSS Battle #7 – Leafy Trail #877
aishwarya-mali
started this conversation in
CSS Battles
Replies: 3 comments
-
Using before & after – 597.24 {479}<div></div>
<style>
body{
background: #0B2429;
display: grid;
place-items: center;
}
div::before, div::after, div{
height: 150px;
width: 150px;
border-radius: 100px 0;
}
div{
background: #998235;
position: relative;
}
div::before, div::after{
content: '';
position: absolute;
}
div::before{
left: -34%;
background: #1A4341;
z-index: -1;
}
div::after{
left: 34%;
background: #F3AC3C;
}
</style> |
Beta Was this translation helpful? Give feedback.
0 replies
-
I had this when I first did this: Three divs, sharing code - 469 chars<div class="a"></div>
<div class="b"></div>
<div class="c"></div>
<style>
body {background:#0B2429}
.a {background:#1A4341;left: calc(50% - 125px);}
.b {background:#998235;left: calc(50% - 75px);}
.c {background:#F3AC3C;left: calc(50% - 25px);}
div {
position: absolute;
border-radius: calc(200% / 3) 0 calc(200% / 3) 0;
top: calc(50% - 75px);
left: calc(50% - 75px);
height: 150px;
width: 150px;
background: #dd6b4d;
}
</style> |
Beta Was this translation helpful? Give feedback.
0 replies
-
Nested leaves – 610 {387}<div class=back>
<div class=middle>
<div class=front></div>
</div>
</div>
<style>
body { background: #0B2429; }
.back {
left: 67px;
top: 67px;
background: #1A4341;
}
.middle { background: #998235; }
.front { background: #F3AC3C; }
div {
position: relative;
left: 50px;
width: 150px;
height: 150px;
border-radius: 100px 0;
}
</style> Refactored using
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Link to battle:
Let's battle! ⚔️
Copy the code block below to format your comment on the discussion thread:
What others will see:
This will result in a nice hidden bit like so:
Code Source – score {character count}
Beta Was this translation helpful? Give feedback.
All reactions