The pseudo-class will only define a particular state of that selector. 5:19. 首先看一下 MDN 上的解释. Possible values could be any color name in any valid format. This pseudo class applies only to the focused element, not its parents, like :checked and :enabled but unlike :active or :hover. Here's an example of the syntax used, can you think of any pseudo classes you have used before? Let's look at a simple example. This sounds like an abstract question, but I'm trying to troubleshoot this project I'm working on and I am at a loss. - MDN Pseudo-class names are not case-sensitive. The :only-child CSS pseudo-class represents an element without any siblings. In the following example, the selector matches any

element that is the first child of any element: Pseudo-classes select elements that already exist. IE9+ Firefox ; Chrome ; Safari ; Opera ; 18. In fact, on the MDN page, that's how they polyfill the .matches() method -- using the .querySelectorAll() and then iterating over the matches and checking for element reference equality. MDN docs, we can see a list of all the standard pseudo-classes. - MDN Web Docs. Like hover: a:hover { /* Yep, hover is a pseudo class */ } They are immensely useful in a variety of situations. MDN: The :focus CSS pseudo-class is applied when an element has received focus, either from the user selecting it with the use of a keyboard or by activating with the mouse (e.g. Note: The :hover pseudo-class is problematic on touchscreens. Depending on the browser, the :hover pseudo-class might never match, match only for a moment after touching an element, or continue to match even after the user has stopped touching and until the user touches another element. MDN has added -moz and -webkit Pseudo elements and classes, e.g. For the purposes of defining the :hover pseudo-class only, an HTML user agent must consider an element as being one that the user designates if it is: An element that the user indicates using a pointing device. A CSS pseudo-class is a keyword added to selectors that specifies a special state of the element to be selected. The :checked CSS pseudo-class selector represents any radio (), checkbox (), or option (