xHTML correctness question and quick CSS float question

Viewed 52

I'm just writing to inquire what would be more correct for xHTML and a CSS question.

For the HTML:

Say I have a list of: Apples, Bananas, and Carrots

Would this be more correct:

<ul> <li> Apples </li> <li>  Bananas </li> <li> Carrots </li> </ul>

Or would this be:

<ol> <li> Apples </li> <li>  Bananas </li> <li> Carrots </li> </ol>

For CSS, after an element has been floated, which attribute can be used to restore flow to block alignment?

Thank you so much.

1 Answers

The ul element stands for "unordered list" which implies it was ordered to begin with (the proper English approach would be no for non-ordered). The ol element stands for "ordered list". Is this list intentionally ordered or not? If you order them alphabetically then I'd considered using the ul element since it's more of a technicality and not some life-or-death importance.

You can work with display and float together. Generally speaking you should look in to the CSS display property. As flexbox support has improved and the bugs have been ironed out I've migrated to using it and reserving float for neat tricks like applying it to an image nested within a bunch of paragraph elements.

Also something people who make six figures have no idea about: XHTML and HTML5 aren't opposed. My platform uses the XML parser while the code is HTML5. A parser takes text and determines how to interpret it for processing. The XML parser is very strict (though not perfectly strict and each browser engine varies, currently Gecko's has been superior) while the HTML parser doesn't mind if there are hobos all over your front lawn and will likely invite even more while it knows you're watching.

Related