Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Validation error: ul not allowed as child of element span

I do not understand why the WC3 validator is flagging this HTML as invalid, the error it reports back is...

''Element ul not allowed as child of element span in this context. (Suppressing further errors from this subtree.)''

I'm using HTML5, and this code is for breadcrumbs.

<span class="bread">
    <ul>
        <li><a href="./index.php">HOME</a></li>
        <li>ABOUT</li>
    </ul>
</span>
like image 360
user2177629 Avatar asked Dec 27 '22 06:12

user2177629


1 Answers

<span> by definition is an inline element (so you use it inside a paragraph, for example), while <ul> is a block element (which is its own little chunk of space, usually with space before/after it unlike <span>).

Other people have had the same issue, and end up using <div> tags instead. See Is it possible to put a list inside a span tag?

like image 77
Stephen Fischer Avatar answered Dec 29 '22 09:12

Stephen Fischer