Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
I am an IT teacher currently preparing a set of teaching notes on how to mark up web pages that will be accessible to the blind and those with cognitive impairments. The notes themselves will also be web pages.
Up to now I have used an <ol>/<ol> nested inside a <pre> element. This method has worked perfectly for a number of years but now my HTML validator tells me one cannot embed an ordered list inside a <pre> element. Hence I am going to Code Forum for help.
 
I'm surprised to hear lists work inside a <pre></pre> block. I don't think it was ever supposed to, because the documentation states
The text will be displayed exactly as written in the HTML source code.
which seems to imply that any inner HTML code will be displayed as-is, tags and all.
Your construction still works, at least in Chrome, but I guess it could break in the future. The validator is right to warn you about it.
 
Last edited by a moderator:
The <pre> element is for preformatted text, so you can't put additional formatting tags inside it. By the look of things, you would be better off using <div> elements instead. The nesting of the lists can be fixed by keeping the nested <ol> elements inside the parent <li> elements
 
Welcome to Code Forum! :)

As you may have noticed already, Code Forum is always ready to help! Did you end up getting this resolved?
 
Alternatively, you can also use a <ul> tag to create an unordered list rather than an <ol> tag (bullet points or squares instead of numbers)
 

New Threads

Latest posts

Buy us a coffee!

Back
Top Bottom