In your HTML:
<div class="comment"> Response1 <div class="comment"> Response1a <div class="comment"> Response1a1 </div> </div> <div class="comment"> Response1b </div> </div>
And in your CSS:
.comment { margin-left: 50px; }
This approach is very flexible and portable. You can also use <ul>/<li> instead of <div> (I think you can argue both in favor and against viewing comments with a stream as semantically equivalent to unordered lists). An internal comment can also be enclosed in another <div> if you need its extra CSS style.
Update: I (a little) prefer <div> over <ul>/<li> because it simplifies your implementation.
First, if you use a list-based approach, you should strip the default <li> style used by most browsers (bullet and padding). Secondly, you probably also want to target the <ul>/<li> set <ul>/<li> to your streaming comments, because they must be different from other list structures. This means that even with a "semantic" approach, you resort to classes. So, in the end, what advantage do you really get, and is it worth the hassle?
We were a little more careful with the use of <ul> structures like this in our projects, and so far we are really happy about that. And, apparently, we are not only one .
source share