HTML validation errors

Posted on 2007-07-22
Last Modified: 2012-05-05

I'm trying to validate my web page, but I'm getting errors I don't understand.

Here are the lines in question:

<ul class="top">
      <span style="text-align:right;"> <li class="top"> <a href="#Link Sites">
            Back to Top</a></li></span>

Error messages:
start tag for "LI" omitted, but its declaration does not permit this.

document type does not allow element "LI" here.

Here is my doc type:


Question by:Lucynka
    LVL 28

    Assisted Solution

    Don't wrap the <li> in a <span>, so don't place another wrapping layer between ul and li...
    LVL 10

    Assisted Solution

    I think the span right after the UL is the culprit. UL expects LI immediately beneath it.
    Try removing the span from its currnet location and place it inside the LI
    Hope iit helps
    LVL 28

    Accepted Solution

    E.g. you could do something like this:

    <ul class="top">
           <li class="top" style="text-align:right;"> <span><a href="#Link Sites">
                Back to Top</a> </span> </li>

    or without span:

    <ul class="top">
           <li class="top" style="text-align:right;"> <a href="#Link Sites">
                Back to Top</a> </li>
    LVL 1

    Author Comment

    Yes, that worked. Thanks!

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
    Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
    In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
    The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now