• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Embedding Lists in XHTML

 
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
get rid of the li element around the ul. It is not needed

Eric
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 249
Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic