Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: How to do a list in a list with XHTML and validate

  1. #1
    Join Date
    Feb 2006
    Posts
    68
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How to do a list in a list with XHTML and validate

    I have been trying to do a list in a list with XHTML and validate it. I used this script and it does work fine, but it won't validate. It says a violation between an inline and a block line element.

    I thought about using a definiton list which may work too but wouldn't get me the numbers in front of the lists.

    Here's the script any ideas how I can change it so it validates with XHTML or ideas which I haven't thought of?

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html>
    <head>
    <title>Here</title>
    <style type="text/css">
    ol{line-height: 150%;
    list-style-type: upper-alpha;
    }
    ol ol{list-style-type: decimal}
    </style>
    </head>
    <body>
    <ol>
    <li>Number 1</li>
    <ol><li>Info Here</li>
    <li>Info Here</li>
    <li>Info Here</li></ol>
    <li>Number 2</li>
    <ol><li>Info Here</li></ol>
    <li>Number 3</li>
    <ol><li>Info Here</li></ol>
    </ol>
    </body>
    </html>

  2. #2
    Join Date
    Jun 2006
    Location
    Acton Ontario Canada.
    Posts
    677
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    <ol>
    <li>Number 1
    <ol><li>Info Here</li>
    <li>Info Here</li>
    <li>Info Here</li></ol>
    </li>
    <li>Number 2
    <ol><li>Info Here</li></ol>
    </li>
    <li>Number 3
    <ol><li>Info Here</li></ol>
    </li>

    you have to have the inner list inside an outer list's item.
    - Ryan "Boxxertrumps" Trumpa
    Come back once it validates: HTML, CSS, JS.

  3. #3
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Try this:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html>
    <head>
    <title>Here</title>
    <style type="text/css">
    ol{line-height: 150&#37;;
    list-style-type: upper-alpha;
    }
    ol ol{list-style-type: decimal}
    </style>
    </head>
    <body>
    <ol>
     <li>Number 1</li>
     <li>
      <ol>
       <li>Info Here</li>
       <li>Info Here</li>
       <li>Info Here</li>
      </ol>
     </li>
    
     <li>Number 2</li>
     <li> 
      <ol>
       <li>Info Here</li>
      </ol>
     </li>
    
     <li>Number 3</li>
     <li>
      <ol>
       <li>Info Here</li>
      </ol>
     </li>
    </ol>
    </body>
    </html>
    This code validates for me. Hope this helps.


    EDIT: Sorry boxxertrumps, posted same time.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  4. #4
    Join Date
    Feb 2006
    Posts
    68
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks so much. Do you know how many time I looked at this. I even went to the library and got a book, and I just kept copying down the example wrong.

    I should've been able to catch this, but anyway thank you both. You guys are great


  5. #5
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    You are aware that IE doesn't support XHTML?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  6. #6
    Join Date
    Mar 2007
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Twey View Post
    You are aware that IE doesn't support XHTML?
    And exactly how do you say that ? XHTML is not like a completely different markup language its just a new standard which is more efficient. it works just about fine with IE.

  7. #7
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    XHTML is not like a completely different markup language its just a new standard which is more efficient. it works just about fine with IE.
    Wrong. Dead wrong.

    Firstly, XHTML is an entirely new markup language. It's not even based on the same standard: XHTML is a profile of XML, while HTML is a profile of SGML. It just happens to have some of the same elements.
    Secondly, XHTML does not work in IE at all. If you send a correct XHTML page, using the MIME type for XHTML (application/xhtml+xml), IE will ask the user where to save the file. If you try to pretend it is HTML by sending it with a text/html MIME type, IE (and all other browsers) will generally error-correct it into HTML, since the syntaxes of the two languages are similar enough that this is possible, but don't be fooled: this is less efficient than correct HTML to parse, not more, and none of the new features of XHTML will be available. You are effectively serving poorly-formed HTML.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  8. #8
    Join Date
    Mar 2007
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Twey View Post
    Wrong. Dead wrong.

    Firstly, XHTML is an entirely new markup language. It's not even based on the same standard: XHTML is a profile of XML, while HTML is a profile of SGML. It just happens to have some of the same elements.
    Secondly, XHTML does not work in IE at all. If you send a correct XHTML page, using the MIME type for XHTML (application/xhtml+xml), IE will ask the user where to save the file. If you try to pretend it is HTML by sending it with a text/html MIME type, IE (and all other browsers) will generally error-correct it into HTML, since the syntaxes of the two languages are similar enough that this is possible, but don't be fooled: this is less efficient than correct HTML to parse, not more, and none of the new features of XHTML will be available. You are effectively serving poorly-formed HTML.
    I didn't meant it in the way of using its own mime type header along with the HTTP protocol. all i meant was that IE renders it no different from firefox if the page is XHTML validated. and you keep the mime type header same.

  9. #9
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    all i meant was that IE renders it no different from firefox if the page is XHTML validated. and you keep the mime type header same.
    Both treat it as invalid HTML, but since Quirks mode is unpredictable, variations will eventually appear.
    all i meant was that IE renders it no different from firefox if the page is XHTML validated. and you keep the mime type header same.
    That's not XHTML.
    Last edited by Twey; 03-21-2007 at 06:06 PM.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  10. #10
    Join Date
    Mar 2007
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Twey View Post
    Both treat it as invalid HTML, but since Quirks mode is unpredictable, variations will eventually appear.
    Okay okay you win.

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
  •