# Chapter 3: Selectors # There are two types of selectors, the *DOM selectors*, which are selectors that directly act on the element on the page, and the *pseudo-selectors* that act on the elements or information that 'sites outside of the document tree. The chapter focuses on the *DOM selectors*. ## Attribute Selectors ## CSS2 Selectors: E[attr] {} /* Simply attribute selector */ E[attr='value'] {} /* Exact attribute selector */ E[attr~='value'] {} /* Partial attribute selector */ E[attr|='value'] {} /* Language attribute selector (based on element's lang attribute */ ### CSS3 Selectors ### E[attr^='value'] {} /* Beginning Selector - Attribute begins with 'value' */ E[attr$='value'] {} /* Ending Selector - Attribute ends with 'value' */ E[attr*='value'] {} /* Arbitrary Selector - Attribute contains 'value' anywhere */ E[selector][selector] {} /* Combine multiple attributes together */ The arbitrary selector is similar to the partial selector in CSS2, but arbitrary selector matches partial strings, while the partial selector only matches whole, space-delimited strings. ### CSS3 Combinator ### E + F {} /* Adjacent Sibling Combinator */ E ~ F {} /* General Sibling Combinator */