This small patch moves the indenting of deep comments in threads from comment.module and into misc/drupal.css. This makes it easy to override the default indent by using a CSS file. For example, I needed to set up a right-to-left web site, and by default comments are indented from the left. I needed to have an easy way of changing it to be from the right.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | comment-indent.patch | 1.94 KB | calanya |
| comment_indent_css.patch | 1.94 KB | calanya |
Comments
Comment #1
dries commentedWouldn't nested div's de-align the comments vertically on what would be the non-indented side? I can't easily test it as the patch does not apply against HEAD.
Comment #2
calanya commentedI just made it. I hope it applies against HEAD.
I don't think adding more divs creates additional vertical spacing. Please test and see.
Ori
Comment #3
dries commentedI seems to work with all themes. The approach is a bit awkward though as it adds a lot of nested <div>s.
Comment #4
calanya commentedI also thought of giving each depth level its own class:
And then in the CSS:
.comment-indent-1 {
margin-left : 25px;
}
.comment-indent-2 {
margin-left : 50px;
}
It keeps the HTML clean with the price of a somewhat more awkward CSS.
This approach might be superior actually because it allows for a greater variety of designs (coloring comments based on their depth?).
Comment #5
calanya commentedI also thought of giving each depth level its own class:
And then in the CSS:
.comment-indent-1 {
margin-left : 25px;
}
.comment-indent-2 {
margin-left : 50px;
}
It keeps the HTML clean with the price of a somewhat more awkward CSS.
This approach might be superior actually because it allows for a greater variety of designs (coloring comments based on their depth?).
Comment #6
Brian@brianpuccio.net commentedAt what point does one stop indenting/modifying appearance? 5 comments in? 10? Pretty soon a very active thread will take up 5% of your browsers width. :D
Wouldn't it also be possibly to make an unordered list for this to handle indenting?
Comment #7
dries commentedPlease, use meaningful titles for issues.
Comment #8
moshe weitzman commentedan unordered list does seem like the 'proper' way to do this.
Comment #9
calanya commentedIn my previous attempt, I wrapped each comment in several div's, as many as its depth. As Dries pointed, that's a lot of extra DIV's.
A UL is not appropiate because it's hard to make UL's CSS work the same across browsers.
What about adding a single DIV to each comment, a wrapper around its child comments?
This keeps the number of extra tags to a minimum, and allows for easy styling of the tree structure.
Comment #10
dries commentedPlease, use meaningful titles for issues (again).
Your last suggestion makes good sense IMO.
Why would you use 'comment-title' when 'title' is sufficent?
Comment #11
calanya commented(Sorry, I thought follow ups were like comments, with their own subject)
I'll post a patch later tonight.
Re comment-title, it differentiates the comment's title from other DIV with class title which might some day be placed under comment. It's protective programming, probably not a good idea. I'll leave it out of the patch.
Comment #12
dries commentedLooking forward to the patch as it makes for better semantic markup.
Comment #13
dries commentedComment #14
jonbob commentedComment #15
chrismessina commentedI've been thinking about how I would like to be able to more effectively style threaded comments and the way that has been proposed here seems to have little semantic basis. Especially if you were to completely disable all styles, threaded comments would render as though they were paragraphs. I think coding threaded comments as definition lists is more semantic and in fact would offer a more reasonable default layout structure.
Consider this example:
And now consider this rendering (ignore this theme's default formatting and view source):
Comment #16
ontwerpwerk commentedThis issue is still not solved in a clean way,
At the moment comments get indented by
<div style="margin-left: 25px;">[comment here]</div>Which is overridable in the theme, but it should either be decided that this issue is closed and the inline CSS stays there to make themers lives hard - or the default behaviour should use no inline CSS.
I vote for no inline CSS.
Comment #17
ontwerpwerk commentedThis is handled in: http://drupal.org/node/87995