Skip to content Skip to sidebar Skip to footer

Can Not Have An Ul Inside An Ol In Html

I get the following validation error when I tested my HTML. Please look at the attached image for the HTML code. 'Element ul not allowed as child of element olin this context.'

Solution 1:

This is because the content model for <ol> (and <ul> actually) is zero or more li elements

These two tags actually can't contain anything other than <li> tags or nothing at all. If you have <ol><ul> browsers will automatically close the <ol> tag before beginning the <ul> (well, the good ones).

I think your intent is to have:

<ol>
    <li>
        <ul>

The <ul> can be contained inside of an <li> that is a child of the <ol>.

Solution 2:

This is because you should wrap the internal <ul> in a list <li> item:

<ul><li>text</li>....</ul>

becomes:

<li><ul><li>text</li>....</ul></li>

Solution 3:

You should do these

<ol>
  ...
  <li>title</li><li><!-- add this --><ul><!-- your ul put here -->
    ...
    </ul></li><!-- add this -->
  ...
</ol>

PS. In some case use original code better than image.

Solution 4:

Try to wrap <ul> part into a <li> tag.

Post a Comment for "Can Not Have An Ul Inside An Ol In Html"