Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

nested lists?

Status
Not open for further replies.

Halcrow

Programmer
Aug 24, 2004
76
GB
hi there,

I want to create a nested list on my webpage, a bit like this:

- item 1
- item 2
+ sub item 1
+ sub item 2
- item 3

but I can't do it! Here is the code I thought would work:

<ul>
<li>Item 1</li>
<li>Item 2
<ul>
<li>Sub Item 1</li>
<li>Sub Item 2</li>
</ul>
</li>
<li>Item 3</li>
</ul>

This doesn't give the required result. It gives:

- Item 1
Item 2
+ sub item 1
- + sub item 2
- Item 3

What am I doing wrong???

Please note: I want my code to validate, that's why I've got the closing tags. I can achieve what I need by removing the closing tags, but this isn't valid, right?

Thanks,
Calum
 
it is!

and not only that, that's exactly the same as my code!

not only that - the list works fine in Firefox but not in IE! (I've just realised)

(I'm still learning and get so annoyed when something works in one browser but not in another)

Cheers
Calum
 
It's ok! I've fixed it by adding a "vertical-align: top;" into my style-sheet!

 
Ah, sorry about that, I didnt even realize.

The code works fine for me in both Firefox and IE, so its strange that you are having trouble.

try only that piece of the code in a separate HTM file and see if it still happens?

Gary
 
ahhhh.....I knew it had to be some other area of the code.

good job then!

Gary
 
I will...the vertical-align: top isn't too hot! the "buttons" are out of line with the text.

cheers
Calum
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top