0

I have this code below:

#comment-1, #comment-2, #comment-3 { width: 70%; margin: 1em 0 0.5em 0; }

This CSS is to format the comments for them to be 70% of the parent div's width. I see where it breaks after 3 comments, how do I get it to apply to all the comments on the page regardless of the number?

1
  • Have a look at the HTML source generated by a comment in your site. There should be a number of classes in addition to the ID comment-{#}. Try using one of those classes in your CSS instead of the individual comment ID numbers.
    – Pat J
    Dec 24, 2013 at 1:41

1 Answer 1

1

By default, WordPress will add some classes to each comment with comment_class(). All comments get the class comment. So you can style comments with:

.comment {
    border: 10px solid red;
}

See wp-includes/comment-template.php for more context.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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