Ultimate CSS Selector Cheatsheet for HTML Parsing
Ultimate companion for HTML parsing using CSS selectors. This cheatsheet contains all syntax explanations with interactive examples.
To select elements by ID value the #
syntax can be used. For example, #product
would select any element that has product
in its ID attribute like <div id="product"></div>
element:
An important note here ID selector matches any element that contains the value in the ID list (separated by spaces). To match elements that has an exact ID value the =
predicate can be used instead: