Can we use any other TAG in <ul>
along with <li>
?
like
<ul> Some text here or <p>Some text here<p> etc <li>item 1</li> Some text here or <p>Some text here<p> etc <li>item 1</li> </ul>
HTML ul element can reside within APPLET, BLOCKQUOTE, BODY, BUTTON, CENTER, DD, DEL, DIV, FIELDSET, FORM, IFRAME, INS, LI, MAP, NOFRAMES, NOSCRIPT, OBJECT, TD, TH.
The short answer is that ol elements are not legally allowed inside p elements.
If it gets displayed correctly, it's only a matter of luck. As you seem to define dangerous by "break in browsers for the end user's ability to view the page as intended", then yes it's dangerous.
This took me a little while to understand because I wrapped my inner ul in its own li tag and not within the li tag that my inner ul was attached to. If you wrap your inner ul in its own li tag you'll get an additional unneeded bullet. Show activity on this post. You need to put the inner ul inside an li element.
For your code to be valid you can't put any tag inside a <ul>
other than an <li>
.
You can however, put any block level element inside the <li>
, like so:
<ul> <li> <h2>...</h2> <p>...</p> <p>...</p> </li> </ul>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With