A crucial rule to remember is that you cannot have spaces in id
values or class names. When there are spaces in the value of the class
attribute, it indicates that multiple classes apply to that particular element:
<p class="paragraph one"> <!--This has both "paragraph" and "one" class-->
Regarding id
values according to HTML4 rules, they must begin with a letter ([A-Za-z]) followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (.):
ID and NAME tokens must begin with a letter ([A-Za-z]) and may be
followed by any number of letters, digits ( [0-9]), hyphens ("-"),
underscores ("_"), colons (":"), and periods (".").
In HTML5 spec, the id attribute specifies an element's unique identifier (ID) where the value must be unique within all IDs in the element's home subtree and contain at least one character. Notably, spaces are not allowed as emphasized below:
The id attribute specifies its element's unique identifier (ID). The
value must be unique amongst all the IDs in the element's home subtree
and must contain at least one character. The value must not contain
any space characters.