Is it possible to use pure CSS to rotate successive elements by a set amount (say 5deg).
I tried the following:
HTML
<div class="container">
<div>Thing 1</div>
<div>Thing 2</div>
<div>Thing 3</div>
</div>
CSS
.container {
counter: my-counter;
}
.container > div {
transform: rotateZ(counter(my-counter)deg);
counter-increment: my-counter 5;
}
/* just to show the counter works: */
.container > div:after {
content: counter(my-counter);
margin-left: 1em;
}
But to no avail.
CSS counters per MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Lists_and_Counters/Using_CSS_counters
Not sure if there is a way to do this considering sibling elements but if you are able to consider nested elements you simple need to do something like this:
.container div {
transform: rotate(10deg);
transform-origin:top left;
margin:10px;
}
<div class="container">
<div>Thing 1
<div>Thing 2
<div>Thing 3</div>
</div>
</div>
</div>