12

I have code like below:

<div class="new-modal *max-height--xxl flex--0-1">

I want to know what does *max-height--xxl mean here?

This is a different question to wildcard * in CSS for classes

I want to ask the * prefix in html class reference.

Community
  • 1
  • 1
huan feng
  • 7,307
  • 2
  • 32
  • 56
  • 2
    Possible duplicate of [wildcard \* in CSS for classes](http://stackoverflow.com/questions/5110249/wildcard-in-css-for-classes) – Laxmikant Dange Oct 19 '15 at 08:55
  • 2
    @LaxmikantDange — No. That's talking about CSS not HTML. – Quentin Oct 19 '15 at 08:55
  • the name tells me that the class `*max-height--xxl` is used for max-height, maybe you have few class named `*max-height--xl` or `*max-height--L` for indicating a setting on max-height selector? – Andrew Oct 19 '15 at 09:01

2 Answers2

13

Nothing in a global sense. In HTML5 there are no restrictions on what characters a class attribute can contain (with the exception of the space character, which is used to separate multiple classes).

For instance, the following HTML is valid:

<figure class="foo bar baz %foo *bar _baz 'foo (bar )baz"></figure>

Here foo is one class, %foo is a second unrelated class and 'foo is a third unrelated class.

The following is also valid:

<figure class="%*_'()"></figure>

The HTML5 specification states that the class attribute must be a set of space-separated tokens. It goes on to define these as:

A set of space-separated tokens is a string containing zero or more words (known as tokens) separated by one or more space characters, where words consist of any string of one or more characters, none of which are space characters.

It's worth noting that these symbols will possibly need escaping (by prefixing them with the a backslash (\) character) in order to be targeted by a CSS selector.

.\%\*\_\'\(\) {
  color: red;
}
<figure class="%*_'()">
  Hello, world!
</figure>
James Donnelly
  • 126,410
  • 34
  • 208
  • 218
5

It doesn't mean anything special. The class name just begins with a * character.

It might be a hack designed to change the class name and, effectively, comment it out so it no longer matches a CSS selector.

var c = document.querySelector('div').classList;
var list = [];
for (var i = 0; i < c.length; i++) {
  list.push(c[i]);
};
document.body.innerHTML = list.join(" / ");
<div class="new-modal *max-height--xxl flex--0-1"></div>
Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335