Targeting comment replies in stylesheet
-
How does one style comments that are replies to another comment? Is it possible?
-
Assuming your theme calls
comment_class()(which it should, if it was downloaded from the official WP.org theme repository), comments that are a reply to another comment are wrapped in a<li>tag with the class “depth-X”. Also, those<li>tags are wrapped in an<ol>tag with the class “children”.Thanks! (The theme isn’t downloaded, it’s my own – sorry, I should have specified)
Now I’ve managed to target the ‘children’ class, I have another related question… I needed to put the comment form in a div as it needed a margin on the left. It appears the small reply buttons on each comment, however, are included in this function, meaning they are affected by this also, making them look quite odd… can you think of a solution for this?
Can you post a link to your site?
:/ Sorry, it’s offline at the moment. What do you need to see? I can post any code you need and take screenshots?
Can you post the contents of
comments.phpto Pastebin and post the link here? Also, a screenshot of the issue would be really helpful.Okay – hope I’ve got the right link:
http://pastebin.com/Tg1Xt6BLAnd screenshot:
http://s1278.photobucket.com/user/glucy/media/comments_zpsff5c4fbf.jpg.html(Everything in div class ‘reply’ is in red to make it easier to see what’s going on… at least, it helps me)
Can you post your theme’s stylesheet to Pastebin as well?
Well, it’s quite large – I’ve pasted the relevant parts:
http://pastebin.com/jHnen095Looks like your issue is caused by this section:
.reply { margin:5% 0 0 5%; ... }That code gives you a 5% margin on the top and on the left. You could change it to something like:
margin-top: 5%;Ah, see, I need that there for the comment form underneath the comments. (Don’t want it butting up against the side) But the small ‘reply’ buttons underneath each comment need to follow a different rule. That’s the issue I’m trying to solve.
I’m sorry, but I’m a bit confused. The comment form (by default) is wrapped in a
<div>with the ID “respond” and the class “comment-respond”, so that rule wouldn’t apply anyway. Unless you’ve modified the comment reply form?
The topic ‘Targeting comment replies in stylesheet’ is closed to new replies.