CSS 属性 选择器

CSS 教程 · 2019-02-28 22:29:17

具有特定属性的HTML元素样式

具有特定属性的HTML元素样式不仅仅是class和id。

注意:IE7和IE8需声明!DOCTYPE才支持属性选择器!IE6和更低的版本不支持属性选择器。

属性选择器

下面的例子是把包含标题(title)的所有元素变为蓝色:

实例

[title] { color:blue; }

属性和值选择器

下面的实例改变了标题title='codercto'元素的边框样式:

实例

[title=codercto] { border:5px solid green; }

属性和值的选择器 - 多值

下面是包含指定值的title属性的元素样式的例子,使用(~)分隔属性和值:

实例

[title~=hello] { color:blue; }

下面是包含指定值的lang属性的元素样式的例子,使用(|)分隔属性和值:

实例

[lang|=en] { color:blue; }

表单样式

属性选择器样式无需使用class或id的形式:

实例

input[type="text"] { width:150px; display:block; margin-bottom:10px; background-color:yellow; } input[type="button"] { width:120px; margin-left:35px; display:block; }

点击查看所有 CSS 教程 文章: https://www.codercto.com/courses/l/23.html

查看所有标签

The Lean Startup

The Lean Startup

Eric Ries / Crown Business / 2011-9-13 / USD 26.00

更多中文介绍:http://huing.com Most startups fail. But many of those failures are preventable. The Lean Startup is a new approach being adopted across the globe, chan ging the way companies are built and ......一起来看看 《The Lean Startup》 这本书的介绍吧!

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

html转js在线工具
html转js在线工具

html转js在线工具

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换