• 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

&nbsp not allowed in element "ul" in this context

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, The code below doesn't cause a problem and it does exactly what I want it to do which is put 2 spaces between the links. The www.w3.org validator doesn't like it. How can this be done without the nbsp?

I had to leave the & off so they would show on the page!!!

Thanks,
Cerito
 
Sheriff
Posts: 3063
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use a CSS line-height rule applied to the li elements.
 
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

Ivan Turner wrote:
I had to leave the & off so they would show on the page!!!


If you are going to be using HTML entities, it's a good idea to understand them. I can make it appear: &   and so on.

As an exercise, figure out how I did that.
 
Bear Bibeault
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
I'd use margin-bottom.

Using text to achieve spacing is a relic from 1998. Use CSS.
 
Bear Bibeault
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 with regard to your topic title, the non-breakling spaces aren't in the <li> elements.
 
Ivan Turner
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Without the nbsb, the output is xxxyyyzzz, I'm using nbsp for spacing but I want xxx yyy zzz output without using it. The nbsp works fine. Though I'm satisfied with the nbsp, is there a simple way to put spaces between the list elements that won't upset the validator?

Thanks for the suggestion. When I have time, I'll figure out how to make the & appear. Disable HTML doesn't do it.
 
Bear Bibeault
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
So you already have CSS to make the list elements appear on the same line? By default, they will appear vertically stacked.

So think! If margin-bottom would add vertical spacing, what could be used to add horizontal spacing?
 
Bear Bibeault
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

Ivan Turner wrote:I'll figure out how to make the & appear. Disable HTML doesn't do it.


No forum tricks; simple markup that would work on any HTML page.
 
Ivan Turner
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:So you already have CSS to make the list elements appear on the same line? By default, they will appear vertically stacked.

So think! If margin-bottom would add vertical spacing, what could be used to add horizontal spacing?



My css entry makes them inline. I guess I need to investigate spacing.

#links li {display:inline; font-size:20px;}

If I change to DOCTYPE xhtml1-transitional.dtd, the error &nbsp validation problem goes away.

How ya like me now Bear Bibeault?
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should not have whitespaces dangling inside of that tag. If you want space characters, they need to live inside of the li element to be valid.

But in reality you need to use padding/margins to pull it off. Basic exaples of using lists as menus http://css.maxdesign.com.au/listamatic/

Eric

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic