Is it ok to use tags without parent tags?
i.e.
some copy
or must it be..
No, that would definitely be invalid (X)HTML. I mean, you could, and the browser might render it correctly if you're lucky (IE in particular, as it tends to be especially lenient), but there's far from any guarantee. You should always enclose <li>
tags with either <ul>
(unordered list) or <ol>
(ordered list). Why wouldn't you want to anyway?
No, using a li
element without a parent ul
or ol
element would be invalid.
li = list item, if it's without parents where's the list?
http://www.w3schools.com/TAGS/tag_li.asp
http://www.w3.org/TR/html401/struct/lists.html
Proper HTML (not to mention strict XHTML) should be:
<ul>
<li>whatever</li>
</ul>
I checked the validation of the code below at Markup Validation Service of W3C :
<li>item 1</li>
<li>item 2</li>
and the result is :
document type does not allow element "LI" here; missing one of "UL", "OL", "DIR", "MENU" start-tag
No, while it might work in some browsers, it is invalid HTML.