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

**URL:** <https://discourse.mozilla.org/t/html-attribute-class-not-supported-by-col-tag-attribut-html-class-non-pris-en-charge-par-la-balise-col/114576>\
**Category:** MDN\
**Created:** [May 18, 2023, 8:18am UTC](https://discourse.mozilla.org/t/html-attribute-class-not-supported-by-col-tag-attribut-html-class-non-pris-en-charge-par-la-balise-col/114576 "2023-05-18T08:18:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![systeme\_D](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/systeme_d/32/62755_2.png) [@systeme\_D](https://discourse.mozilla.org/u/systeme_D)\
**Post date:** [May 18, 2023, 8:18am UTC](https://discourse.mozilla.org/t/html-attribute-class-not-supported-by-col-tag-attribut-html-class-non-pris-en-charge-par-la-balise-col/114576/1 "2023-05-18T08:18:39Z")

</div>

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](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](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 !**

---

<div class="post-metadata">

**Author:** ![mikoMK](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/mikomk/32/50456_2.png) [@mikoMK](https://discourse.mozilla.org/u/mikoMK)\
**Post date:** [May 18, 2023, 1:39pm UTC](https://discourse.mozilla.org/t/html-attribute-class-not-supported-by-col-tag-attribut-html-class-non-pris-en-charge-par-la-balise-col/114576/2 "2023-05-18T13:39:02Z")

</div>

Bonjour @systeme_D et bienvenue dans la communauté 👋

> [@systeme\_D](#):
>
> the “class” HTML attribute is not supported by the col tag.

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](https://www.w3.org/TR/CSS21/tables.html#columns) 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](https://github.com/mdn/translated-content/issues) and/or making a pull request to add this important piece of information.

Have a nice day,  
Michael
