According to the HTML Specs and answers to this question, an ol cannot be contained inside a p. But why not?
I’m writing a paper in APA style in which I’d like to use an ordered list in paragraph form. (See OWL and editing-writing for implementations of lists—ordered and unordered—in APA format.)
Sometimes, it makes sense to have a list displayed in paragraph form, and why can’t that list semantically be part of the paragraph? For example, in my paper, I have:
… a problem set involving (a) converting between numbers between 0 and 1 in scientific notation and standard decimal form, (b) counting place values of numbers greater than 0, (c) comparing positive and negative numbers with magnitude less than 1, and (d) adding and subtracting numbers in scientific notation. See the attached …
If you don’t believe this list is semantically part of the paragraph, please state why you think so, because I’m interested in your opinion.
I’d really like to know how I can write this list using the HTML tags <ol> and <li>, but have them displayed as if they were part of the paragraph. The reason is that semantically, these items are part of an ordered list and to include them in the correct element is good for SEO, yet I am curious of how to keep the list written in paragraph form.
The reason why
olandulcurrently can’t be contained inside of apis because paragraph elements can only contain inline elements, and lists are block-level elements.Perhaps lists shouldn’t be automatically considered block-level elements, but that isn’t the case at the moment.
So your options are to just split that excerpt into 2 paragraphs, with a list between them, e.g.
Or just create an inline list, which may not validate, but is semantically correct and will render just fine in most browsers.