I want to create a reddit comment layout similar to this:
<div>
<div class="comment" style="background: white;">
<div class="comment" style="background: grey;"></div>
<div class="comment" style="background: grey;">
<div class="comment" style="background: white;">
<div class="comment" style="background: grey;"></div>
</div>
</div>
<div class="comment" style="background: white;"></div>
</div>
It's how my html code generated by Rails currently looks:
<div class="comment_main-list">
<div class="comment_list">
<div class="comment">blabla</div>
<div class="comment_main-list">
<div class="comment_list">
<div class="comment">answer to blabla</div>
</div>
</div>
</div>
<div class="comment_list">...</div>
</div>
I tried using Sass loops for the styling, but I'm unable to predict the number of comments in advance. Nth-child or nth-type selectors didn't give me the desired outcome either.
Any ideas on how I can achieve this layout?
Thank you