Html attribute "class" not supported by <col> tag / Attribut html "class" non pris en charge par la balise <col>

Good morning,

I just found out that the “class” HTML attribute is not supported by the col tag. I read this info on Chatgpt, which explains that it’s because of the HTML spec itself. That is, it’s based on the initial design of the HTML language and the choices made by spec authors who decided to focus on other tag-specific attributes to define properties columns in a table.

However, when I search on Google, I can’t find any information about it. Even in MDN, I can’t find anything, especially in the section dealing with the tag https://developer.mozilla.org/fr/docs/Web/HTML/Element/col.

On the other hand, there is an example of HTML and CSS code showing how to use the tag with the “class” attribute but when I test it on Visual Studio Code it does not work, the properties of the "class " have no effect when added to the tag.

So my question is, is it true that the HTML “class” attribute is not taken into account by the tag and is there any documentation about it?

Thanks for your help,
and may the code be with you!

Bonjour,

Je viens de découvrir que l’attribut HTML “class” n’est pas pris en charge par la balise col. J’ai lu cette information sur Chatgpt, qui explique que c’est à cause de la spécification HTML elle-même. C’est-à-dire que c’est basée sur la conception initiale du langage HTML et les choix faits par les auteurs des spécifications qui ont décidé de se concentrer sur d’autres attributs spécifiques à la balise pour définir des propriétés des colonnes dans un tableau.

Cependant, quand je cherche sur Google, je ne trouve aucune information à ce sujet. Même dans MDN, je ne trouve rien, notamment dans la rubrique traitant de la balise https://developer.mozilla.org/fr/docs/Web/HTML/Element/col.

Par contre, il y a un exemple de code HTML et CSS montrant comment utiliser la balise avec l’attribut “class” mais quand je le teste sur Visual Studio Code cela ne fonctionne pas, les propriétés de l’attribut “class” n’ont aucun effet quand on l’ajoute à la balise .

Donc, ma question est la suivante, est-ce que c’est vrai que l’attribut HTML “class” n’est pas pris en compte par la balise et existe-t-il une documentation à ce sujet ?

Merci pour votre aide,
et que le code soit avec vous !

Bonjour @systeme_D et bienvenue dans la communauté :wave:

This statement is wrong. class is supported on the <col> tag, but not all CSS properties. From the English version of the article:

<col> allows styling columns using CSS, but only a few properties will have an effect on the column (see the CSS 2.1 specification for a list).

The linked spec chapter lists: border, background, width and visibility. When you add font-size: 10em; to the .batman class in the example, nothing will happen, but when you add border: 5px dashed red; you will see the changes.

Unfortunately, the quoted paragraph from above isn’t included in the French translation (as far as I see). I recommend opening an issue on the MDN “translated content” repo and/or making a pull request to add this important piece of information.

Have a nice day,
Michael