Formatting an indented list in CSS
- by Colen
Hi,
Let's say I have a list, with an arbitrary number of indentation levels, like so:
Item
Item
Item
Item
Item
Item
Item
Item
Item
Item
Item
If I'm displaying this list in an HTML document, how can I use CSS to handle the indentation? There might be an arbitrary number of indentation levels (although in practice there isn't going to be more than 5 or so).
I don't want to create an "indent1" class that indents 10 pixels, an "indent2" class that indents 20 pixels, etc - that's clumsy. Is it possible to create a general rule that will indent by a certain distance based on an attribute value, or the position of an element in the hierarchy?