applying indent on divs i a tree structure

L

lars.gundersen

Hi,

I need to apply some indenting (margin) on my divs. I have a forum
which uses a tree structure so that the users will be able to see which
user replies to what topic.

Is there some kind of "easy" way to go though my divs and apply
leftmargin style on my divs so that indent? Please be aware of there
can be an unlimited number of levels.

Here is my html:

<div id="a">topic 1</div>
<div id="b">repley</div>
<div id="b">repley</div>
<div id="c">repley</div>
<div id="c">repley</div>
<div id="d">repley</div>
<div id="d">repley</div>
<div id="c">repley</div>
<div id="b">repley</div>
<div id="a">indlæg</div>
 
M

marss

If you cannot change html:

<style>
#a{padding-left:10px}
#b{padding-left:20px}
#c{padding-left:30px}
#d{padding-left:40px}

etc...

</style>
<div id="a">topic 1</div>
<div id="b">repley</div>
<div id="b">repley</div>
<div id="c">repley</div>
<div id="c">repley</div>
<div id="d">repley</div>
<div id="d">repley</div>
<div id="c">repley</div>
<div id="b">repley</div>
<div id="a">indflag</div>


But if you can change html it seems for me more preferable is next
html:
<style>
div{padding-left: 10;display:block}
</style>
<div>topic 1
<div>repley</div>
<div>repley
<div>repley</div>
<div>repley
<div>repley</div>
<div>repley</div>
</div>
<div>repley</div>
</div>
<div>repley</div>
</div>
<div>indflag</div>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top