基本的选择器规则(Selector) 类型(Type)选择器 类(Class)选择器 ID 选择器 参数(Attribute)选择器 通配符 组合选择器(Combinator) 子选择器和后代选择器 兄弟选择器和相邻兄弟选择器 选择器列表 伪类(Pseudo-Classes) 链接和按钮相关 表单输入相关 DOM 子节点相关 DOM 相关的其他伪类 其他 伪元素(Pseudo-ele
<button>:定义可点击的按钮。 <select>和<option>:定义下拉列表。 三、HTML属性(Attributes) HTML属性用于为HTML标签提供额外的信息。它们位于标签的开始部分,通常是键值对形式,如:<tag attribute="value">。 3.1 通用属性 这些属性可以应用于大多数HTML元素: id:定义元素的唯一标识符。例如: <div id="header">...
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": ...
使用[attribute]来选择所有具有 attribute 属性的元素: 使用[attribute=value] 来选择具有指定属性及属性值的元素: 使用[attribute~=value] 来选择具有指定属性,并且该属性的多个值中包含给定值的元素: 使用[attribute*=value] 来选择具有指定属性,并且该属性的值中包含特定部分值的元素。 使用[attribute^=value] 来...
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=...
[attribute=value]:选中具有指定属性和值的元素。例如,div[class='a']选中class为a的<div>元素。[attribute*=value]:选中具有指定属性且属性值包含指定文本的元素。[attribute^=value]:选中具有指定属性且属性值以指定文本开头的元素。[attribute$=value]:选中具有指定属性且属性值以指定文本结尾的...
type selector: elementname class selector: .classname ID selector: #idName universal selector: * ns|* *|* attribute selector [attr=value] Combinators adjacent sibling selectors A+B General sibling selectors A~B Child selectors A>B
consttoggleBtn = document.querySelector("#toggle-theme"); toggleBtn.addEventListener('click', e => { console.log("Switching theme"); if(document.documentElement.hasAttribute('theme')){ document.documentElement.removeAttribute('theme'); }
import { Component } from '@angular/core';import { IonButton } from '@ionic/angular/standalone';@Component({ selector: 'app-example', templateUrl: 'example.component.html', styleUrls: ['example.component.css'], imports: [IonButton],})export class ExampleComponent {} CSS Custom Properties...
Selector [attribute=value]4.07.02.03.19.6 CSS Syntax [attribute=value] { css declarations; }Demo More Examples Example Set the width of an <input type="text"> element to 100px. However, when it gets focus, make it 250px wide: