$0.98

What are valid values for the id attribute in HTML?

Ask a question+
1

When creating theid attributes for HTML elements, what rules are there for the value?

add comment

1 Answer

2

For HTML5, id has to contain at least one character and may not contain any spaces.

In XHTML, ids are case-sensitive.

Periods, colons, and hashtags have a special meaning in CSS selectors, so if you use those in ids, you’d have to escape them with a backslash in a CSS selector, or a double backslash in a CSS selector string passed to jQuery.

add comment

Your Answer