Can't select div with id=“:1”

前端 未结 2 658
感动是毒
感动是毒 2021-01-26 16:28

Kind of a noob to web stuff, but I have a div which has this tag:

2条回答
  •  故里飘歌
    2021-01-26 16:58

    Quote from the official documentation for HTML4:

    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 (".").

    An ID starting with : is invalid. Some browser MAY be able to use it, but you shouldn't count on it. Start your ID with letters only.

    In HTML5 this string is allowed, and since you are specifying your document as HTML5 this seems not to be the problem.

    I'll still leave the answer here, maybe it helps someone with a similar problem.

提交回复
热议问题