Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Embedding Lists in XHTML

 
Corey McGlone
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey folks,

I always thought this was a simple thing to do, but, in XHTML, I'm getting some strange results. Basically, I have an unordered list and, as one of my list elements, I want to have another unordered list, something like this:



Unfortunately, that just doesn't display very well. I get the "dot" for the sublist and I end up with an additional break in the middle of my list. Any quick ideas?

Thanks,
Corey
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
get rid of the li element around the ul. It is not needed

Eric
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64845
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And you can change the visuals by applying CSS rules to the list and its elements. Though I have found that the browsers can be quirky about it...
 
Corey McGlone
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Eric Pascarello:
get rid of the li element around the ul. It is not needed


Well, that's what I had started with. Unfortunately, in XHTML, it appears that it is needed. If I run the XHTML through the W3C Validator, it won't pass validation unless the li element encloses the ul element. Perhaps I'll just try to work it out with CSS.
 
Mike Firkser
Ranch Hand
Posts: 249
Java Oracle PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What I have found works is if you embed the new list in the previous <li> tag:

 
Corey McGlone
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mike Rutgers:
What I have found works is if you embed the new list in the previous <li> tag:


Ah! Perfect! Not sure why I hadn't tried that earlier, but that does just what I want. Thanks, Mike.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic