Мегафон

События (селекторы, поведения) CSS. Селекторы Селекторы css справочник

CSS selectors define the elements to which a set of CSS rules apply.

Basic selectors

Universal selector Selects all elements. Optionally, it may be restricted to a specific namespace or to all namespaces.
Syntax: * ns |* *|*
Example: * will match all the elements of the document. Type selector Selects all elements that have the given node name.
Syntax: elementname
Example: input will match any element is used to create interactive controls for web-based forms in order to accept data from the user; a wide variety of types of input data and control widgets are available, depending on the device and user agent. "> element. Class selector Selects all elements that have the given class attribute.
Syntax: . classname
Example: .index will match any element that has a class of "index". ID selector Selects an element based on the value of its id attribute. There should be only one element with a given ID in a document.
Syntax: # idname
Example: #toc will match the element that has the ID "toc". Attribute selector Selects all elements that have the given attribute.
Syntax: [ attr ] [ attr = value ] [ attr ~= value ] [ attr |= value ] [ attr ^= value ] [ attr $= value ] [ attr *= value ]
Example: will match all elements that have the autoplay attribute set (to any value).

Grouping selectors

Selector list The , is a grouping method, it selects all the matching nodes.
Syntax: A , B
Example: div, span will match both and ) is the generic container for flow content. It has no effect on the content or layout until styled using CSS.">
elements.

Combinators

Descendant combinator The (space) combinator selects nodes that are descendants of the first element.
Syntax: A B
Example: div span will match all elements that are inside a ) is the generic container for flow content. It has no effect on the content or layout until styled using CSS.">
element. Child combinator The > combinator selects nodes that are direct children of the first element.
Syntax: A > B
Example: ul > li will match all element is used to represent an item in a list.">
  • elements that are nested directly inside a element represents an unordered list of items, typically rendered as a bulleted list.">