Is it acceptable / correct to use integers as class names in this case [duplicate]

StackOverflow https://stackoverflow.com/questions/21856130

  •  13-10-2022
  •  | 
  •  

سؤال

I'm creating a simple to use responsive grid and at the moment have following code

.column {
    display: block;
    float:left;
}

.column.12 {
    width: 100%;
}

/* .. */

.column.6 {
    width: 50%;
}

/* .. */

Where integer relates to different size of a column

<div class="column 12"></div>

Above is an example usage.

هل كانت مفيدة؟

المحلول

No. Class names cannot start or be digits. An alternative would be to make class names that end with digits to signify their meaning.

.column12 {
    width: 100%;
}

.column6 {
    width: 50%;
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top