0

HTML

<p style="font-size:24px;">Inline Test</p>
<p class="1head">TEST</p>
<p class="1body">TEST</p>

CSS

@font-face {
    font-family: SegoeUI;
    src: url(segoeui.ttf); /* Yes, it is licensed */
}
body {
    padding: 0px;
    font-family: SegoeUi;
    margin: 0px;
    font-weight: 400;
}
.1head {
    font-size: 24px;
    color: #2C3E50;
    padding-bottom: 10px;
}
.1body {
    font-size: 16px;
    color: #2C3E50;
}

The p element does not seem to be accepting a class or ID.

When I use my web browser tools to view if the CSS is coming through properly, it doesn’t appear at all. Other CSS elements, such as div's, etc. accept CSS from the same style sheet. How can this problem be fixed?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
user3123121
  • 13
  • 2
  • 4
  • possible duplicate of [CSS classes with names that start with numbers](http://stackoverflow.com/questions/21227702/css-classes-with-names-that-start-with-numbers) – Jukka K. Korpela Jan 29 '14 at 19:52
  • change the names of classes as how we are assign the name to variable like it will solve you problem ..using number begning of the class name it make problem – HD.. Jan 30 '14 at 10:31
  • Hurrah. The Stack Overflow syntax highlight actually hints there is something that is off. – Peter Mortensen Feb 27 '22 at 03:28

2 Answers2

7

See W3C's Syntax and basic data types, 4.1.3 Characters and case:

In CSS, identifiers (including element names, classes, and IDs in selectors) can contain only the characters [a-z0-9] and ISO 10646 characters U+00A1 and higher, plus the hyphen (-) and the underscore (_); they cannot start with a digit, 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".

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
D'Arcy Rittich
  • 167,292
  • 40
  • 290
  • 283
0

It starts with a number. ID's can't start with numbers. Also, check this out.

Eedis
  • 15
  • 2
  • 1
    Under HTML5, Id's **can** start with numbers. Classes, however, cannot. http://www.w3.org/TR/html5/dom.html#the-id-attribute – Paulie_D Jan 29 '14 at 17:26
  • 2
    @Paulie_D - This has nothing to do with HTML5, or even really HTML at all. This is a CSS limitation. – Alohci Jan 29 '14 at 17:47