473,382 Members | 1,180 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

applying indent on divs i a tree structure

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>

Jan 26 '06 #1
2 2367
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>

Jan 26 '06 #2
On 2006-01-26, la************@gmail.com <la************@gmail.com> wrote:
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>


you shouldn't repeat the same id like that.

changing the the HTML to reflect the structure will probably help too.

(<ul> might be better suited)

<div>a_topic
<ul><li>b_repley</li>
<li>b_repley
<ul><li>c_repley</li>
<li>c_repley
<ul><li>d_repley</li>
<li>d_repley</li>
</ul></li>
<li>c_repley</li>
</ul></li>
<li>b_repley</li>
</ul>
indlęg
</div>

that'll probably still need some styling, but probably much less.

Bye.
Jasen
Jan 27 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Steve Johnson | last post by:
Been banging my head on this for two days now. Hope someone can help! My test program below is in the form of a single JSP, with a Node class build in. (All the coded needed to run is below.) ...
12
by: deko | last post by:
Is there any way to work around the blank space created by hidden divs? I'm trying to use a relatively postioned divs with show/hide behaviors to annotate an image. The divs show/hide...
1
by: Srihari | last post by:
I'm trying to develop a tree structure using javascript. The node values of the tree are generating from a mysql table depending on login. The tree structure contains 3 sub levels. I developed...
4
by: Stephan Tobies | last post by:
Hi everyone, I am looking for a good data structure that could be used to represent families of trees with shared sub-trees and copy-on-write semantics. On a very abstract level, I would like...
29
by: Richard Lionheart | last post by:
Hi All, I've taken the advice of a few people and managed to cobble together an HTML 4.01 Strict-compliant document (according to the W3C Validation Service), but the way I try to pass a...
5
by: hankypan1 | last post by:
Hi All, I need a tree data structure for my application. It is the non -cyclic simple tree where i can have any number of children node and each child can recursively become a sub tree like a...
8
by: =?ISO-8859-1?Q?m=E9choui?= | last post by:
Problem: - You have tree structure (XML-like) that you don't want to create 100% in memory, because it just takes too long (for instance, you need a http request to request the information from...
0
by: mac | last post by:
I found that with memory allocating techniques used nowadays (addresses alignment, eg. on 32bit machines) one can detect loops in a tree structure very fast, without using extra memory. This is due...
7
by: Yesurbius | last post by:
I am receiving the following error when attempting to run my query. In my mind - this error should not be happening - its a straight-forward query with a subquery. I am using Access 2003 with all...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.