CSS class starting with number is not getting applied

前端 未结 4 1641
死守一世寂寞
死守一世寂寞 2020-12-20 07:19

I\'m trying to create a webpage that contains images. However, I want all the images to be the same size and in the same format. I have the following CSS class which applies

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-20 08:15

    Another very useful notation is this:

    [class="200"]{
      width: 200px;
      height: 200px;
    }
    

    W3C specifications however state:

    In CSS, identifiers (including element names, classes, and IDs in selectors) can contain only the characters [a-zA-Z0-9] and ISO 10646 characters U+00A0 and higher, plus the hyphen (-) and the underscore (_); they cannot start with a digit, two hyphens, or a hyphen followed by a digit. Identifiers can also contain escaped characters and any ISO 10646 character as a numeric code (see next item). For instance, the identifier “B&W?” may be written as “B\&W\?” or “B\26 W\3F”.

    So you might want to consider rethinking your class names instead

提交回复
热议问题