CSS Battle #110 – Sunrays #1333
Narigo
started this conversation in
CSS Battles
Replies: 3 comments
-
First go using
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Code Source – 627.21 {282}Guessing position after rotating: <div><div><div><div><div><div><div>
<style>
body {
background:#D25B70;
margin:194px 79px;
rotate: -30deg;
}
div {
rotate: 30deg;
transform-origin: 120px 5px;
width: 100px;
height: 10px;
background: #F2E09F;
border-radius: 9px;
}
</style> An easier version for positioning, but with more characters: Code Source – 624.27 {294}One trick to make it easier to get to the position by translating first and then rotating <div><div><div><div><div><div><div>
<style>
body {
background:#D25B70;
transform: translate(131px, 132px) rotate(-30deg);
}
div {
rotate: 30deg;
transform-origin: 120px 5px;
width: 100px;
height: 10px;
background: #F2E09F;
border-radius: 9px;
}
</style> And a little fun with animation in the end! Code Source
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Code Source – 600 {1306}<div>
<div class="rectangle"></div>
<div class="rectangle"></div>
<div class="rectangle"></div>
<div class="rectangle"></div>
<div class="rectangle"></div>
<div class="rectangle"></div>
<div class="rectangle"></div>
</div>
<style>
body{
margin: 0;
background: #D25B70;
}
.rectangle {
position: absolute;
top: 200px;
left: 50%;
width: 100px; /* Rectangle width */
height: 10px; /* Rectangle height */
background-color: #F2E09F;
border-radius: 50px;
transform-origin: center; /* Rotate around the center */
}
/* Define individual rotations for each rectangle */
.rectangle:nth-child(1) { transform: translate(-50%, -50%) rotate(180deg) translateX(70px); }
.rectangle:nth-child(2) { transform: translate(-50%, -50%) rotate(210deg) translateX(70px); }
.rectangle:nth-child(3) { transform: translate(-50%, -50%) rotate(240deg) translateX(70px); }
.rectangle:nth-child(4) { transform: translate(-50%, -50%) rotate(270deg) translateX(70px); }
.rectangle:nth-child(5) { transform: translate(-50%, -50%) rotate(300deg) translateX(70px); }
.rectangle:nth-child(6) { transform: translate(-50%, -50%) rotate(330deg) translateX(70px); }
.rectangle:nth-child(7) { transform: translate(-50%, -50%) rotate(360deg) translateX(70px); }
</style> |
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
Uh oh!
There was an error while loading. Please reload this page.
-
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 {characters}
Beta Was this translation helpful? Give feedback.
All reactions