Vishmax.com
Read

How to show alternate comment colors in WordPress

We design and develop websites, digital experiences, and software solutions for growing businesses.

By adding below PHP code to your template you can display comments in alternate colors. It uses a counter with an increment and a two CSS classes.

PHP

 
<?php if ( $comments ) : ?>:
<ul>
<?php
          $i = 0;
          foreach ($comments as $comment) :
          $i++;
?>
<li id="comment-<?php comment_ID() ?>"<?php if($i&1) { echo 'class="odd"';} else {echo 'class="even"';} ?>>

CSS Class

 
.odd  { background:#f8f6e4; }
.even { background:#f9f8f0; }