Search code examples
htmllistflexbox

Is it acceptable to have non-<li> elements inside a <ul> in HTML?


I'm working on a project where I find it convenient to include elements other than <li> inside a <ul>. Is this semantically correct and acceptable in HTML or should I make the elements start with <li>?

I have below one list inside another one. The element I am trying to put has the tag <textarea>.

Example:

    <ul class="list">
        <li class="category">what + how + who</li>
            <ul class="subcategories">
                <li>WHAT do we do?</li>
                <textarea class="input"></textarea>
                <li>HOW do we do it?</li>
                <li>WHO do we serve?</li>
            </ul>
    </ul>

Solution

  • Neither <textarea> or <ul> is a valid child of <ul>.

    Valid children are as follows...