W3 Validation problem - document type does not allow element "ul" here

Discussion in 'HTML & Website Design' started by angelro, Jul 18, 2011.

  1. #1
    Hey guys. I have the following piece of code:

    <ul>
    <li>
    <p class="frame_1"><img src="images/x.jpg" alt="x"/></p>
    <a href="x.html" class="frame_2"><img src="img/button2.gif" alt=""/></a>
    <a href="x.html">
    <ul class="ul_1">
    <li class="li_2"><b>something1</b></li>
    <li class="li_1">something2</li>
    <li class="li_1">something3</li>
    <li class="li_1">something4</li>
    <li class="li_1">something5</li>
    <li class="li_1">something6</li>
    </ul>
    </a>
    </li>
    </ul>

    However, I keep getting this message, and don't know how I can avoid it ? Can you please correct the code and paste in here the correct code that I should use ?

    "
    Line 188, Column 17: document type does not allow element "ul" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag
    <ul class="ul_1">
    ✉
    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>").
    "
     
    angelro, Jul 18, 2011 IP
  2. harry.singh

    harry.singh Active Member

    Messages:
    38
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    98
    #2
    You can not put <ul> in <a> tags that is the reason you are getting that error...

    <ul>
    <li>
    <p class="frame_1"><img src="images/x.jpg" alt="x"/></p>
    <a href="x.html" class="frame_2"><img src="img/button2.gif" alt=""/></a>	
    <ul class="ul_1">
    <li class="li_2"><b>something1</b></li>
    <li class="li_1">something2</li>
    <li class="li_1">something3</li>
    <li class="li_1">something4</li>
    <li class="li_1">something5</li>
    <li class="li_1">something6</li>
    </ul> 
    </li>
    </ul>
    HTML:
    This will validate....
     
    harry.singh, Jul 19, 2011 IP