Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

    <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…

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading