Meaning | Described in section | |
CSS 2.1 selectorsFollowing fragment was taken from W3C CSS 2.1 specification |
||
* | Matches any element. | Universal selector |
E | Matches any E element (i.e., an element of type E). | Type selectors |
E F | Matches any F element that is a descendant of an E element. | Descendant selectors |
E > F | Matches any F element that is a child of an element E. | Child selectors |
E:first-child | Matches element E when E is the first child of its parent. | The :first-child pseudo-class |
E:link E:visited |
Matches element E if E is the source anchor of a hyperlink of which the target is not yet visited (:link) or already visited (:visited). | The link pseudo-classes |
E:active E:hover E:focus |
Matches E during certain user actions. | The dynamic pseudo-classes |
E + F | Matches any F element immediately preceded by a sibling element E. | Adjacent selectors |
E[foo] | Matches any E element with the "foo" attribute set (whatever the value). | Attribute selectors |
E[foo="warning"] | Matches any E element whose "foo" attribute value is exactly equal to "warning". | Attribute selectors |
E[foo~="warning"] | Matches any E element whose "foo" attribute value is a list of space-separated values, one of which is exactly equal to "warning". | Attribute selectors |
E[foo%="warning"] | Matches any E element whose "foo" attribute value is a list of space-separated values, one of which is equal to "warning" case insensitively. | non-standard |
E[lang|="en"] | Matches any E element whose "lang" attribute has a hyphen-separated list of values beginning (from the left) with "en". | Attribute selectors |
DIV.warning | Language specific. (In HTML, the same as DIV[class~="warning"].) | Class selectors |
E#myid | Matches any E element with ID equal to "myid". | ID selectors |
CSS 3.0 selectors |
||
E:not( {simple selector} ) |
Negation.
Example: E:not(:first-child) matches all E elements that are not at first child position in their containers. |
The negation pseudo-class |
E[foo^="val"] | Matches any E element having "foo" attribute whose value begins with the prefix "val" | |
E[foo$="val"] | Matches any E element having "foo" attribute whose value ends with the suffix "val" | |
E[foo*="val"] | Matches any E element having "foo" attribute whose value contains at least one instance of the substring "val". | |
E:nth-child(An+B) | Matches any E element which is Bth child of an parent element after all its children have been split into groups of A elements each. A and B are integer numbers. | Structural Pseudo Classes |
E:nth-last-child(An+B) | Matches any E element which is Bth child of an parent element after all its children have been split into groups of A elements each and counting from last to first direction. | |
E:not(simple selector) | Represents an element that is not represented by the simple selector. | Negation Pseudo Class |
E:only-child | Represents an element that has a parent element and whose parent element has no other children other than this one. | :only-child pseudo-class |
E:only-of-type | Represents an element that has a parent element and whose parent element has no other element children with the same element name | :only-of-type pseudo-class |
E:has-child-of-type(T) | Represents an element that has exactly single child element of type T among its other children. | Non standard, h-smile core specific. |
E:has-children-of-type(T) | Represents an element that has one or more children elements of type T among its other children. | |
Run-time state flags (mostly h-smile core specific) |
||
E:focus | Matches element in focus state. | STATE_FOCUS |
E:tab-focus | Matches element that got focus by pressing TAB keyboard button. | STATE_TABFOCUS |
E:focusable | Matches any element which has tabindex defined or will accept focus. Behaviors attached to elements are responsible for "focusability" (accept HANDLE_FOCUS events). For example behaviors under <a href>'s and most of <input>/<widget> elements are focusable by default. Elements that have overflow:auto | scroll are also intrinsically focusable. | STATE_FOCUSABLE |
E:current | Matches current element in collection. E.g. current <option> in <select>. | STATE_CURRENT |
E:checked | Matches element in checked state. Internal behaviors checkbox, radio and select (for option) are known to set/reset this flag. | STATE_CHECKED |
E:disabled | Matches element in disabled state. All elements in container having disabled attribute defined will also have this flag set. | STATE_DISABLED |
E:read-only | Matches element in read-only state (with readonly attribute defined) | STATE_READONLY |
E:expanded | Matches element in expanded state. Internal behavior select are known to set/reset this flag. Used for implementation of collapsible nodes in the <select>. | STATE_EXPANDED |
E:collapsed | Inversed to :expanded attribute. Element can have either expanded or collapsed or neither expanded nor collapsed state but not both. | STATE_COLLAPSED |
E:incomplete | Is set when element is in incomplete state - one of requested resources (e.g. background or foreground image) is not arrived yet. | STATE_INCOMPLETE |
E:busy | E.g. is set when element requested some data to download and this data is not arrived yet. This flag can be set from code of behaviors. | STATE_BUSY |
E:empty | Matches element that has no textual content and no children. | STATE_EMPTY |
E:has-child | Matches element that has exactly one child. | STATE_HAS_CHILD |
E:has-children | Matches element that has more than one child. | STATE_HAS_CHILDREN |
E:animating | Element, at the moment, is animating e.g. expanding/collapsing | STATE_ANIMATING |
E:popup | Element, at the moment, is shown as a popup. | STATE_POPUP |
E:owns-popup | Element requested popup to be shown and that popup is shown at the moment. | STATE_OWNS_POPUP |
E:synthetic | Element is synthesized by the engine while parsing e.g. all missed cells in tables (<td>) are getting this flag. | STATE_SYNTHETIC |
E:drop-target | While inside the active drag-n-drop opeartion this element is a valid drop target for the dragged element. | STATE_DROP_TARGET |
E:drag-over | Matches drop target element when dragged element is over it. | STATE_DRAG_OVER |
E:moving | Matches drag-moving element (temporary copy of the drag-source). | STATE_MOVING |
E:copying | Matches drag-copying element (temporary copy of the drag-source). | STATE_COPYING |
E:drag-source | Matches drag source element in active drag-n-drop operation. | STATE_DRAG_SOURCE |
E:rtl | Matches element in strictly Right-To-Left environment - when it or its nearest container has defined dir attribute and the value of that dir attribute is exactly "rtl". | |
E:ltr | Matches element in strictly Left-To-Right environment - when it or its nearest container has defined dir attribute and the value of that dir attribute is exactly "ltr". | |
Pseudo elements | ||
::before | ::before creates a pseudo-element that is the first child of the selected element. It is often used to add cosmetic content to an element with the content property. It is inline by default. | |
::after | ::after creates a pseudo-element that is the last child of the selected element. It is often used to add cosmetic content to an element with the content property. It is inline by default. | |
::marker |
::marker defines special pseudo element that is rendered on top of background layer and underneath content. The marker gets replaced inside padding box of the element and can use flex units. For example this:
div::marker { size:1em; margin:*; background:red; border-radius:0.5em; } will render 1em circle in the center of the div. Can be uses to add cosmetic content to elements. It is a block, flow:text element by default. | Non standard, h-smile core specific. |
::shade | ::shade is what is known as Shadow DOM root - special [pseudo] element that can be rendered as below, as above, as instead of host element content.
The shade element gets replaced inside padding box of the element and can use flex units. For example this: div::marker { size:1em; margin:*; background:red; border-radius:0.5em; } will render 1em circle in the center of the div. Can be uses to add cosmetic content to elements. It is a block element by default. |