SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: validation

  1. #1
    SitePoint Evangelist
    Join Date
    Nov 2004
    Location
    Netherlands
    Posts
    542
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    validation

    I am trying to correct the errors in the page but not understand how to solve these:

    Code:
     Below are the results of checking this document for XML well-formedness and validity.
    
       1. Error Line 144, column 5: document type does not allow element "br" here; assuming missing "li" start-tag .
    
          <br />
    
          ✉
       2. Error Line 145, column 5: document type does not allow element "li" here; missing one of "ul", "ol", "menu", "dir" start-tag .
    
            <li><a class="navleft" href="">Bookings</a></li>
    
          The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.
    
          One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").
    
          ✉
       3. Error Line 146, column 5: document type does not allow element "li" here; missing one of "ul", "ol", "menu", "dir" start-tag .
    
            <li><a class="navleft" href="">Conditions</a></li>
    
          ✉
       4. Error Line 147, column 4: end tag for "li" omitted, but OMITTAG NO was specified .
    
          </ul>
    
          You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".
    
          ✉
       5. Info Line 144, column 0: start tag was here .
    
          <br />
    The html:
    HTML Code:
    <ul id="nav">
      <li><a class="navleft" href="">Worldwide Holidays</a></li>
      <li><a class="navleft" href="">Luxury Travel</a></li>
      <li><a class="navleft" href="">Wellness &amp; Spas</a></li>
      <li><a class="navleft" href="">Safaris in Africa</a></li>
      <li><a class="navleft" href="">Luxury Train Journeys</a></li>
      <li><a class="navleft" href="">Sports and Adventures</a></li>
    <br />
      <li><a class="navleft" href="">Bookings</a></li>
      <li><a class="navleft" href="">Conditions</a></li>
    </ul>
    I already thought that the <br /> to create some extra spacing within the list is working, but not valid coding.

    - how to solve the <br /> issue different as renaming the "nav" element from id into class and make two lists?

    thanks for the hint(s)

  2. #2
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can't have a BR element as an immediate child of a UL. Exactly what the validator's error message says. The only thing a UL can contain is LI elements.

    Put your <br&#160;/> tag inside a list item.
    Birnam wood is come to Dunsinane

  3. #3
    SitePoint Evangelist
    Join Date
    Nov 2004
    Location
    Netherlands
    Posts
    542
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    AutisticCuckoo,

    Putting the <br /> within the <li> ..</li> is not working because of the css.

    alltravel-consultancy.com you can see the page and the navigation list at the left. when moving the break the images are out of line.

    Is there some other way, or do I have to change the id into a class, or even make a second identical id=navothername for a second list which contains the last couple of links?
    Last edited by dancing-mathilde; Nov 14, 2006 at 13:51.

  4. #4
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The 'normal' way to insert some space between two list items would be to assign a class or ID to one of them and set an extra margin or padding for that class/ID via CSS.

    Another option, of course, is to split the list into two ULs, if the two groups of list items are sufficiently different from one another.
    Birnam wood is come to Dunsinane

  5. #5
    SitePoint Evangelist
    Join Date
    Nov 2004
    Location
    Netherlands
    Posts
    542
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks,

    As you see I decided to make two different lists. Say the top one is about the products and the second one about how to get them and services.

  6. #6
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's what I would have done, too.
    Birnam wood is come to Dunsinane


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •