基本的选择器规则(Selector) 类型(Type)选择器 类(Class)选择器 ID 选择器 参数(Attribute)选择器 通配符 组合选择器(Combinator) 子选择器和后代选择器 兄弟选择器和相邻兄弟选择器 选择器列表 伪类(Pseudo-Classes) 链接和按钮相关 表单输入相关 DOM 子节点相关 DOM 相关的其他伪类 其他 伪元素(Pseudo-elements...
https://developer.mozilla.org/en-US/docs/Web/CSS/Reference#Selectors 在css3规范中,定义了以下几种类型的selector: Basic selector type selector: elementname class selector: .classname ID selector: #idName universal selector: * ns|* *|* attribute selector [attr=value] Combinators adjacent sib...
CSS [attribute~="value"] Selector The[attribute~="value"]selector is used to select elements with an attribute value containing a specified word. The following example selects all elements with a title attribute that contains a space-separated list of words, one of which is "flower": ...
CSS [attribute|="value"] Selector The[attribute|="value"]selector is used to select elements with the specified attribute, whose value can be exactly the specified value, or the specified value followed by a hyphen (-). Note:The value has to be a whole word, either alone, like class=...
<select>和<option>:定义下拉列表。 三、HTML属性(Attributes) HTML属性用于为HTML标签提供额外的信息。它们位于标签的开始部分,通常是键值对形式,如:<tag attribute="value">。 3.1 通用属性 这些属性可以应用于大多数HTML元素: id:定义元素的唯一标识符。例如: ...
使用[attribute$=value] 来选择具有指定属性,并且该属性的值以给定值结尾的元素。 伪类 链接伪类选择器 这4 个伪类用于选择链接处于不同状态的元素。它们最常与链接一起使用,但是:active也适用于按钮,而:hover可以用于各种元素: :link:选取未被访问过的链接,用于为用户尚未点击的超链接设置样式。
CSS Selector 之 Attribute Selector 这个从名字上就很好理解,即根据属性来选择元素。 举几个例子: input[type="password"] input[type] /* 有 type 属性的 input */ 当然,也支持复杂的正则方式匹配 a[href$=".pdf"] 即,属性 href 以 .pdf 为结尾的 a 标签。
These custom properties are calculated only when needed, and are not saved according to other rules. For example, you can't set an attribute on an element and then have it get a value from a sibling or descendant rule. Properties are only used to match the current selector and its descen...
Selector [attribute$=value]4.07.03.53.29.6 CSS Syntax attribute$=value{ css declarations; }Demo More Examples Example Style all elements that have a class attribute value that ends with "test": [class$="test"]{ background:salmon; }
Selector [attribute] 4.0 7.0 2.0 3.1 9.6Note: For [attribute] to work in IE8 and earlier, a <!DOCTYPE> must be declared.CSS Syntax[attribute] { css declarations;} Demo Related PagesCSS tutorial: CSS Attribute Selectors« Previous CSS Selectors Reference Next » ...