I am using Drupal 7. I have a question/answer website, I want to theme reply comments differently from node comments. How can I apply a different css theme to differentiate node comments from comment replies? I checked the css class and both node comments and comment replies have the same css class. So how do I add different css class to comment replies and theme them differently?

Clarification: My question is just about theming comment replies differently, like removing borders around them or adding background to all comment replies, while node comments (answers) remain same.

  • Please note that this a css related question that is perhaps better asked on stackoverflow.com. It is not directly Drupal related. Commented Jan 11, 2014 at 13:52

1 Answer 1


You will have to use the surrounding classes to target the direct comments. Consider a site with the following structure (this is actually based on drupal.org):

<div class="content">
  <div id="node-01" class="node node-forum clearfix">
    ... Node content ...
  <section class="comments comment-wrapper">
    <h2 class="title">Comments</h2>  
    <a id="comment-7635897"></a>

    <div class="comment clearfix">
      ... Comment content ... 

    <div class="indented"><a id="comment-7728095"></a>
      <div class="comment comment-by-node-author clearfix">
        ... Comment reply ...

Node comments can be targeted with the CSS selector .comment-wrapper > .comment. (only target first level childs).

Replies can be targeted with .indented .comment (target all level childs of indented comments).

So have a look at your site's structure and try a similar approach.

  • yes i noticed that .indented handles the replies, thanks for sharing Commented Jan 12, 2014 at 3:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.