The specification of HTML5 defines ul
so (free translation):
The element ul
represents a list of unordered items; that is, a list whose meaning does not change if the order of the items that compose it is changed.
If you want to follow to the letter what the specification says, it may be the case to use an ordered list, since its content looks like a feed of messages, which would lose meaning if not in chronological order (correct me if I misunderstood your example).
Semantically speaking, is any list I have passive to use uls? Even if within this list are large and complex contents?
It is recommended that any list be represented as a list, i.e., ul
, ol
or dl
(the latter is a little different, can be considered a list of key pairs/value). However...
Notice: Opinion content below!
Any discussion about semantics always involves a considerable amount of opinion. I’ve seen people argue that a list of links within a nav
does not need to be represented as the list, because the nav
would already mean a "list of navigation items"; some people defend the opposite.
One of the great arguments in favor of "semantic HTML" is that it would be a step towards the semantic web. And the semantic web is the one where machines can exchange information about the meaning of the content they access or store. Well, what would be the gain in knowing that such a content is an unedited list? This says nothing about the content, and very little about its structure.
So always look at the semantics discussions with one foot behind you. There are no absolute truths; it is no use wanting to follow everything you say, or fatally you fall into contradiction. It is interesting that its content is well structured and that this structure makes sense when read by humans. In my opinion this is the most important at this time, in 2014. I would rather represent your messages as list items, but that’s not so other than owning div
s with class mensagem
inside of another div
with class mensagens
. If the list and its items do not carry any class, the Divs with classes even carry more meaning.
I may be mistaken, but I had the impression that HTML 4.01 was very restrictive in relation to what could go inside a
<li>
. HTML5, on the other hand, is very permissive, even allowing headers, which according to the specification would be contradictory (because headers determine sections, and it makes no sense for a list to cross the boundary from one section to another). Overall I agree with your answer (mine follows the same line), but to be honest I never really understood what great gain a screen reader, and especially a bot, would have to know that a content is a list.– bfavaretto
@bfavaretto, you’re right when you say HTML 4.0.1, I fixed my answer, as for the screen reader, I’ve needed and accurate, and I really notice difference in formatting, not at all but in a large part of them.
– abfurlan
Actually screen readers seem to be the biggest beneficiaries by the use of lists. You can pause between items, etc. I have very little experience with them, but I understand how you can use them. Google, for example, does not know what distinction could be made to rank something based on whether or not it is contained in the list. Note that I’m not criticizing your answer, I found it great, I’m just thinking out loud!
– bfavaretto
@bfavaretto, I agree and find interesting, however from what I have researched, use
ul
can help boot identify more easily, a sequence of related items, a list of subjects, a group of links or options, an image gallery and etc.– abfurlan
boot
orbot
?– brasofilo
@brasofilo, thanks for Obs, is bot, I edited the reply :)
– abfurlan