Le 06/01/2025 à 20:16, Steve Litt a écrit :
> Didier Kryn said on Fri, 3 Jan 2025 21:22:24 +0100
>
>> Le 03/01/2025 à 10:28, Steve Litt a écrit :
>>> I use <br/> and <hr/> all the time in HTML5, and it passes both my
>>> well formed XML check and w3c validation.
>> I just tried it and checked with the W3C validator installed the
>> "easy way" according to your instructions and it produces the message
>> below:
>>
>> ...:103.7-103.11: info: Trailing slash on void elements has no effect
>> and interacts badly with unquoted attribute values.
>>
>> I must mention tha my doctype is just HTML, without the url referring
>> to XHTML.
>>
>> -- Didier
> Ahah, you're right! I
> submittedhttps://troubleshooters.com/web/css.com to the w3c validator
> athttps://validator.w3.org/ and got six of the info messages you got.
> I normally validity check html5 with a downloaded .jar file, and for
> some reason I've long forgotten, that checker doesn't output infos
> about trailing slashes.
>
> The info makes clear that the disadvantage of a trailing slash in HTML
> is that it interacts badly with unquoted attribute values. The person
> who doesn't quote attribute values almost certainly wouldn't use my
> techniques anyway, because my techniques would be too rigorous for them.
I too never use unquoted attribute values. Nevertheless the
validator's warning means that trailing slashes are considered
unfriendly by html5 even if they are tolerated. Therefore I would either
use xhtml or plain html and stick to the standard.
I've never written xhtml. I gave a glance at its documentation
years ago and decided, maybe too quickly, it'd take me too much work to
make sense of it. Therefore I'll probably continue with plain html5 for
some time.
Note that omitting the closing tag is sometimes convenient, for
example ommitting the </td> is tolerated, at least for simple things.
Consider the following example:
<tr><th class="1"> example <th> other <th> more <th> what
else <th> even more </tr>
<tr><td class="1"> foo <td> bar <td> foo.bar <td> foo/bar
<td> barfoo </tr>
<tr><td class="1"> Lua <td> Smalltalk <td> C <td> Scheme
<td> SNOBOL </tr>
Inserting the closing tags would make the lines too long, and
breaking the lines would break the pretty alignment.
-- Didier