CSS3 选择器
在 CSS 中,选择器是一种模式,用于选择需要添加样式的元素。
"CSS" 列指示该属性是在哪个 CSS 版本中定义的。(CSS1、CSS2 还是 CSS3。)
选择器 | 例子 | 例子描述 | CSS |
---|---|---|---|
.class | .intro | 选择 class="intro" 的所有元素。 | 1 |
#id | #firstname | 选择 id="firstname" 的所有元素。 | 1 |
* | * | 选择所有元素。 | 2 |
element | p | 选择所有 <p> 元素。 | 1 |
element,element | div,p | 选择所有 <div> 元素和所有 <p> 元素。 | 1 |
element element | div p | 选择 <div> 元素内部的所有 <p> 元素。 | 1 |
element>element | div>p | 选择父元素为 <div> 元素的所有 <p> 元素。 | 2 |
element+element | div+p | 选择紧接在 <div> 元素之后的所有 <p> 元素。 | 2 |
[attribute] | [target] | 选择带有 target 属性所有元素。 | 2 |
[attribute=value] | [target=_blank] | 选择 target="_blank" 的所有元素。 | 2 |
[attribute~=value] | [title~=flower] | 选择 title 属性包含单词 "flower" 的所有元素。 | 2 |
[attribute|=value] | [lang|=en] | 选择 lang 属性值以 "en" 开头的所有元素。 | 2 |
:link | a:link | 选择所有未被访问的链接。 | 1 |
:visited | a:visited | 选择所有已被访问的链接。 | 1 |
:active | a:active | 选择活动链接。 | 1 |
:hover | a:hover | 选择鼠标指针位于其上的链接。 | 1 |
:focus | input:focus | 选择获得焦点的 input 元素。 | 2 |
:first-letter | p:first-letter | 选择每个 <p> 元素的首字母。 | 1 |
:first-line | p:first-line | 选择每个 <p> 元素的首行。 | 1 |
:first-child | p:first-child | 选择属于父元素的第一个子元素的每个 <p> 元素。 | 2 |
:before | p:before | 在每个 <p> 元素的内容之前插入内容。 | 2 |
:after | p:after | 在每个 <p> 元素的内容之后插入内容。 | 2 |
:lang(language) | p:lang(it) | 选择带有以 "it" 开头的 lang 属性值的每个 <p> 元素。 | 2 |
element1~element2 | p~ul | 选择前面有 <p> 元素的每个 <ul> 元素。 | 3 |
[attribute^=value] | a[src^="https"] | 选择其 src 属性值以 "https" 开头的每个 <a> 元素。 | 3 |
[attribute$=value] | a[src$=".pdf"] | 选择其 src 属性以 ".pdf" 结尾的所有 <a> 元素。 | 3 |
[attribute*=value] | a[src*="abc"] | 选择其 src 属性中包含 "abc" 子串的每个 <a> 元素。 | 3 |
:first-of-type | p:first-of-type | 选择属于其父元素的首个 <p> 元素的每个 <p> 元素。 | 3 |
:last-of-type | p:last-of-type | 选择属于其父元素的最后 <p> 元素的每个 <p> 元素。 | 3 |
:only-of-type | p:only-of-type | 选择属于其父元素唯一的 <p> 元素的每个 <p> 元素。 | 3 |
:only-child | p:only-child | 选择属于其父元素的唯一子元素的每个 <p> 元素。 | 3 |
:nth-child(n) | p:nth-child(2) | 选择属于其父元素的第二个子元素的每个 <p> 元素。 | 3 |
:nth-last-child(n) | p:nth-last-child(2) | 同上,从最后一个子元素开始计数。 | 3 |
:nth-of-type(n) | p:nth-of-type(2) | 选择属于其父元素第二个 <p> 元素的每个 <p> 元素。 | 3 |
:nth-last-of-type(n) | p:nth-last-of-type(2) | 同上,但是从最后一个子元素开始计数。 | 3 |
:last-child | p:last-child | 选择属于其父元素最后一个子元素每个 <p> 元素。 | 3 |
:root | :root | 选择文档的根元素。 | 3 |
:empty | p:empty | 选择没有子元素的每个 <p> 元素(包括文本节点)。 | 3 |
:target | #news:target | 选择当前活动的 #news 元素。 | 3 |
:enabled | input:enabled | 选择每个启用的 <input> 元素。 | 3 |
:disabled | input:disabled | 选择每个禁用的 <input> 元素 | 3 |
:checked | input:checked | 选择每个被选中的 <input> 元素。 | 3 |
:not(selector) | :not(p) | 选择非 <p> 元素的每个元素。 | 3 |
::selection | ::selection | 选择被用户选取的元素部分。 | 3 |
按功能类别排列
New : HTML5 中的新标签。
基础
标签 | 描述 |
---|---|
<!DOCTYPE> | 定义文档类型。 |
<html> | 定义 HTML 文档。 |
<title> | 定义文档的标题。 |
<body> | 定义文档的主体。 |
<h1> to <h6> | 定义 HTML 标题。 |
<p> | 定义段落。 |
<br> | 定义简单的折行。 |
<hr> | 定义水平线。 |
<!--...--> | 定义注释。 |
格式
标签 | 描述 |
---|---|
<acronym> | 定义只取首字母的缩写。 |
<abbr> | 定义缩写。 |
<address> | 定义文档作者或拥有者的联系信息。 |
<b> | 定义粗体文本。 |
<bdi> | 定义文本的文本方向,使其脱离其周围文本的方向设置。 |
<bdo> | 定义文字方向。 |
<big> | 定义大号文本。 |
<blockquote> | 定义长的引用。 |
<center> | 不赞成使用。定义居中文本。 |
<cite> | 定义引用(citation)。 |
<code> | 定义计算机代码文本。 |
<del> | 定义被删除文本。 |
<dfn> | 定义定义项目。 |
<em> | 定义强调文本。 |
<font> | 不赞成使用。定义文本的字体、尺寸和颜色 |
<i> | 定义斜体文本。 |
<ins> | 定义被插入文本。 |
<kbd> | 定义键盘文本。 |
<mark> | 定义有记号的文本。 |
<meter> | 定义预定义范围内的度量。 |
<pre> | 定义预格式文本。 |
<progress> | 定义任何类型的任务的进度。 |
<q> | 定义短的引用。 |
<rp> | 定义若浏览器不支持 ruby 元素显示的内容。 |
<rt> | 定义 ruby 注释的解释。 |
<ruby> | 定义 ruby 注释。 |
<s> | 不赞成使用。定义加删除线的文本。 |
<samp> | 定义计算机代码样本。 |
<small> | 定义小号文本。 |
<strike> | 不赞成使用。定义加删除线文本。 |
<strong> | 定义语气更为强烈的强调文本。 |
<sup> | 定义上标文本。 |
<sub> | 定义下标文本。 |
<time> | 定义日期/时间。 |
<tt> | 定义打字机文本。 |
<u> | 不赞成使用。定义下划线文本。 |
<var> | 定义文本的变量部分。 |
<wbr> | 定义视频。 |
表单
标签 | 描述 |
---|---|
<form> | 定义供用户输入的 HTML 表单。 |
<input> | 定义输入控件。 |
<textarea> | 定义多行的文本输入控件。 |
<button> | 定义按钮。 |
<select> | 定义选择列表(下拉列表)。 |
<optgroup> | 定义选择列表中相关选项的组合。 |
<option> | 定义选择列表中的选项。 |
<label> | 定义 input 元素的标注。 |
<fieldset> | 定义围绕表单中元素的边框。 |
<legend> | 定义 fieldset 元素的标题。 |
<isindex> | 不赞成使用。定义与文档相关的可搜索索引。 |
<datalist> | 定义下拉列表。 |
<keygen> | 定义生成密钥。 |
<output> | 定义输出的一些类型。 |
框架
标签 | 描述 |
---|---|
<frame> | 定义框架集的窗口或框架。 |
<frameset> | 定义框架集。 |
<noframes> | 定义针对不支持框架的用户的替代内容。 |
<iframe> | 定义内联框架。 |
图像
标签 | 描述 |
---|---|
<img> | 定义图像。 |
<map> | 定义图像映射。 |
<area> | 定义图像地图内部的区域。 |
<canvas> | 定义图形。 |
<figcaption> | 定义 figure 元素的标题。 |
<figure> | 定义媒介内容的分组,以及它们的标题。 |
音频/视频
标签 | 描述 |
---|---|
<audio> | 定义声音内容。 |
<source> | 定义媒介源。 |
<track> | 定义用在媒体播放器中的文本轨道。 |
<video> | 定义视频。 |
链接
标签 | 描述 |
---|---|
<a> | 定义锚。 |
<link> | 定义文档与外部资源的关系。 |
<nav> | 定义导航链接。 |
列表
标签 | 描述 |
---|---|
<ul> | 定义无序列表。 |
<ol> | 定义有序列表。 |
<li> | 定义列表的项目。 |
<dir> | 不赞成使用。定义目录列表。 |
<dl> | 定义定义列表。 |
<dt> | 定义定义列表中的项目。 |
<dd> | 定义定义列表中项目的描述。 |
<menu> | 定义命令的菜单/列表。 |
<menuitem> | 定义用户可以从弹出菜单调用的命令/菜单项目。 |
<command> | 定义命令按钮。 |
表格
标签 | 描述 |
---|---|
<table> | 定义表格 |
<caption> | 定义表格标题。 |
<th> | 定义表格中的表头单元格。 |
<tr> | 定义表格中的行。 |
<td> | 定义表格中的单元。 |
<thead> | 定义表格中的表头内容。 |
<tbody> | 定义表格中的主体内容。 |
<tfoot> | 定义表格中的表注内容(脚注)。 |
<col> | 定义表格中一个或多个列的属性值。 |
<colgroup> | 定义表格中供格式化的列组。 |
样式/节
标签 | 描述 |
---|---|
<style> | 定义文档的样式信息。 |
<div> | 定义文档中的节。 |
<span> | 定义文档中的节。 |
<header> | 定义 section 或 page 的页眉。 |
<footer> | 定义 section 或 page 的页脚。 |
<section> | 定义 section。 |
<article> | 定义文章。 |
<aside> | 定义页面内容之外的内容。 |
<details> | 定义元素的细节。 |
<dialog> | 定义对话框或窗口。 |
<summary> | 为 <details> 元素定义可见的标题。 |
元信息
标签 | 描述 |
---|---|
<head> | 定义关于文档的信息。 |
<meta> | 定义关于 HTML 文档的元信息。 |
<base> | 定义页面中所有链接的默认地址或默认目标。 |
<basefont> | 不赞成使用。定义页面中文本的默认字体、颜色或尺寸。 |
编程
标签 | 描述 |
---|---|
<script> | 定义客户端脚本。 |
<noscript> | 定义针对不支持客户端脚本的用户的替代内容。 |
<applet> | 不赞成使用。定义嵌入的 applet。 |
<embed> | 为外部应用程序(非 HTML)定义容器。 |
<object> | 定义嵌入的对象。 |
<param> | 定义对象的参数。 |
CSS3 动画属性(Animation)
属性 | 描述 | CSS |
---|---|---|
@keyframes | 规定动画。 | 3 |
animation | 所有动画属性的简写属性,除了 animation-play-state 属性。 | 3 |
animation-name | 规定 @keyframes 动画的名称。 | 3 |
animation-duration | 规定动画完成一个周期所花费的秒或毫秒。 | 3 |
animation-timing-function | 规定动画的速度曲线。 | 3 |
animation-delay | 规定动画何时开始。 | 3 |
animation-iteration-count | 规定动画被播放的次数。 | 3 |
animation-direction | 规定动画是否在下一周期逆向地播放。 | 3 |
animation-play-state | 规定动画是否正在运行或暂停。 | 3 |
animation-fill-mode | 规定对象动画时间之外的状态。 | 3 |
CSS 背景属性(Background)
属性 | 描述 | CSS |
---|---|---|
background | 在一个声明中设置所有的背景属性。 | 1 |
background-attachment | 设置背景图像是否固定或者随着页面的其余部分滚动。 | 1 |
background-color | 设置元素的背景颜色。 | 1 |
background-image | 设置元素的背景图像。 | 1 |
background-position | 设置背景图像的开始位置。 | 1 |
background-repeat | 设置是否及如何重复背景图像。 | 1 |
background-clip | 规定背景的绘制区域。 | 3 |
background-origin | 规定背景图片的定位区域。 | 3 |
background-size | 规定背景图片的尺寸。 | 3 |
CSS 边框属性(Border 和 Outline)
属性 | 描述 | CSS |
---|---|---|
border | 在一个声明中设置所有的边框属性。 | 1 |
border-bottom | 在一个声明中设置所有的下边框属性。 | 1 |
border-bottom-color | 设置下边框的颜色。 | 2 |
border-bottom-style | 设置下边框的样式。 | 2 |
border-bottom-width | 设置下边框的宽度。 | 1 |
border-color | 设置四条边框的颜色。 | 1 |
border-left | 在一个声明中设置所有的左边框属性。 | 1 |
border-left-color | 设置左边框的颜色。 | 2 |
border-left-style | 设置左边框的样式。 | 2 |
border-left-width | 设置左边框的宽度。 | 1 |
border-right | 在一个声明中设置所有的右边框属性。 | 1 |
border-right-color | 设置右边框的颜色。 | 2 |
border-right-style | 设置右边框的样式。 | 2 |
border-right-width | 设置右边框的宽度。 | 1 |
border-style | 设置四条边框的样式。 | 1 |
border-top | 在一个声明中设置所有的上边框属性。 | 1 |
border-top-color | 设置上边框的颜色。 | 2 |
border-top-style | 设置上边框的样式。 | 2 |
border-top-width | 设置上边框的宽度。 | 1 |
border-width | 设置四条边框的宽度。 | 1 |
outline | 在一个声明中设置所有的轮廓属性。 | 2 |
outline-color | 设置轮廓的颜色。 | 2 |
outline-style | 设置轮廓的样式。 | 2 |
outline-width | 设置轮廓的宽度。 | 2 |
border-bottom-left-radius | 定义边框左下角的形状。 | 3 |
border-bottom-right-radius | 定义边框右下角的形状。 | 3 |
border-image | 简写属性,设置所有 border-image-* 属性。 | 3 |
border-image-outset | 规定边框图像区域超出边框的量。 | 3 |
border-image-repeat | 图像边框是否应平铺(repeated)、铺满(rounded)或拉伸(stretched)。 | 3 |
border-image-slice | 规定图像边框的向内偏移。 | 3 |
border-image-source | 规定用作边框的图片。 | 3 |
border-image-width | 规定图片边框的宽度。 | 3 |
border-radius | 简写属性,设置所有四个 border-*-radius 属性。 | 3 |
border-top-left-radius | 定义边框左上角的形状。 | 3 |
border-top-right-radius | 定义边框右下角的形状。 | 3 |
box-decoration-break | 3 | |
box-shadow | 向方框添加一个或多个阴影。 | 3 |
Box 属性
属性 | 描述 | CSS |
---|---|---|
overflow-x | 如果内容溢出了元素内容区域,是否对内容的左/右边缘进行裁剪。 | 3 |
overflow-y | 如果内容溢出了元素内容区域,是否对内容的上/下边缘进行裁剪。 | 3 |
overflow-style | 规定溢出元素的首选滚动方法。 | 3 |
rotation | 围绕由 rotation-point 属性定义的点对元素进行旋转。 | 3 |
rotation-point | 定义距离上左边框边缘的偏移点。 | 3 |
Color 属性
属性 | 描述 | CSS |
---|---|---|
color-profile | 允许使用源的颜色配置文件的默认以外的规范。 | 3 |
opacity | 规定书签的级别。 | 3 |
rendering-intent | 允许使用颜色配置文件渲染意图的默认以外的规范。 | 3 |
Content for Paged Media 属性
属性 | 描述 | CSS |
---|---|---|
bookmark-label | 规定书签的标记。 | 3 |
bookmark-level | 规定书签的级别。 | 3 |
bookmark-target | 规定书签链接的目标。 | 3 |
float-offset | 将元素放在 float 属性通常放置的位置的相反方向。 | 3 |
hyphenate-after | 规定连字单词中连字符之后的最小字符数。 | 3 |
hyphenate-before | 规定连字单词中连字符之前的最小字符数。 | 3 |
hyphenate-character | 规定当发生断字时显示的字符串。 | 3 |
hyphenate-lines | 指示元素中连续断字连线的最大数。 | 3 |
hyphenate-resource | 规定帮助浏览器确定断字点的外部资源(逗号分隔的列表)。 | 3 |
hyphens | 设置如何对单词进行拆分,以改善段落的布局。 | 3 |
image-resolution | 规定图像的正确分辨率。 | 3 |
marks | 向文档添加裁切标记或十字标记。 | 3 |
string-set | 3 |
CSS 尺寸属性(Dimension)
属性 | 描述 | CSS |
---|---|---|
height | 设置元素高度。 | 1 |
max-height | 设置元素的最大高度。 | 2 |
max-width | 设置元素的最大宽度。 | 2 |
min-height | 设置元素的最小高度。 | 2 |
min-width | 设置元素的最小宽度。 | 2 |
width | 设置元素的宽度。 | 1 |
可伸缩框属性(Flexible Box)
属性 | 描述 | CSS |
---|---|---|
box-align | 规定如何对齐框的子元素。 | 3 |
box-direction | 规定框的子元素的显示方向。 | 3 |
box-flex | 规定框的子元素是否可伸缩。 | 3 |
box-flex-group | 将可伸缩元素分配到柔性分组。 | 3 |
box-lines | 规定当超出父元素框的空间时,是否换行显示。 | 3 |
box-ordinal-group | 规定框的子元素的显示次序。 | 3 |
box-orient | 规定框的子元素是否应水平或垂直排列。 | 3 |
box-pack | 规定水平框中的水平位置或者垂直框中的垂直位置。 | 3 |
CSS 字体属性(Font)
属性 | 描述 | CSS |
---|---|---|
font | 在一个声明中设置所有字体属性。 | 1 |
font-family | 规定文本的字体系列。 | 1 |
font-size | 规定文本的字体尺寸。 | 1 |
font-size-adjust | 为元素规定 aspect 值。 | 2 |
font-stretch | 收缩或拉伸当前的字体系列。 | 2 |
font-style | 规定文本的字体样式。 | 1 |
font-variant | 规定是否以小型大写字母的字体显示文本。 | 1 |
font-weight | 规定字体的粗细。 | 1 |
内容生成(Generated Content)
属性 | 描述 | CSS |
---|---|---|
content | 与 :before 以及 :after 伪元素配合使用,来插入生成内容。 | 2 |
counter-increment | 递增或递减一个或多个计数器。 | 2 |
counter-reset | 创建或重置一个或多个计数器。 | 2 |
quotes | 设置嵌套引用的引号类型。 | 2 |
crop | 允许被替换元素仅仅是对象的矩形区域,而不是整个对象。 | 3 |
move-to | 从流中删除元素,然后在文档中后面的点上重新插入。 | 3 |
page-policy | 确定元素基于页面的 occurrence 应用于计数器还是字符串值。 | 3 |
Grid 属性
属性 | 描述 | CSS |
---|---|---|
grid-columns | 规定网格中每个列的宽度。 | 3 |
grid-rows | 规定网格中每个列的高度。 | 3 |
Hyperlink 属性
属性 | 描述 | CSS |
---|---|---|
target | 简写属性,设置target-name、target-new以及target-position属性。 | 3 |
target-name | 规定在何处打开链接(链接的目标)。 | 3 |
target-new | 规定目标链接在新窗口还是在已有窗口的新标签页中打开。 | 3 |
target-position | 规定在何处放置新的目标链接。 | 3 |
CSS 列表属性(List)
属性 | 描述 | CSS |
---|---|---|
list-style | 在一个声明中设置所有的列表属性。 | 1 |
list-style-image | 将图象设置为列表项标记。 | 1 |
list-style-position | 设置列表项标记的放置位置。 | 1 |
list-style-type | 设置列表项标记的类型。 | 1 |
marker-offset | 2 |
CSS 外边距属性(Margin)
属性 | 描述 | CSS |
---|---|---|
margin | 在一个声明中设置所有外边距属性。 | 1 |
margin-bottom | 设置元素的下外边距。 | 1 |
margin-left | 设置元素的左外边距。 | 1 |
margin-right | 设置元素的右外边距。 | 1 |
margin-top | 设置元素的上外边距。 | 1 |
Marquee 属性
属性 | 描述 | CSS |
---|---|---|
marquee-direction | 设置移动内容的方向。 | 3 |
marquee-play-count | 设置内容移动多少次。 | 3 |
marquee-speed | 设置内容滚动得多快。 | 3 |
marquee-style | 设置移动内容的样式。 | 3 |
多列属性(Multi-column)
属性 | 描述 | CSS |
---|---|---|
column-count | 规定元素应该被分隔的列数。 | 3 |
column-fill | 规定如何填充列。 | 3 |
column-gap | 规定列之间的间隔。 | 3 |
column-rule | 设置所有 column-rule-* 属性的简写属性。 | 3 |
column-rule-color | 规定列之间规则的颜色。 | 3 |
column-rule-style | 规定列之间规则的样式。 | 3 |
column-rule-width | 规定列之间规则的宽度。 | 3 |
column-span | 规定元素应该横跨的列数。 | 3 |
column-width | 规定列的宽度。 | 3 |
columns | 规定设置 column-width 和 column-count 的简写属性。 | 3 |
CSS 内边距属性(Padding)
属性 | 描述 | CSS |
---|---|---|
padding | 在一个声明中设置所有内边距属性。 | 1 |
padding-bottom | 设置元素的下内边距。 | 1 |
padding-left | 设置元素的左内边距。 | 1 |
padding-right | 设置元素的右内边距。 | 1 |
padding-top | 设置元素的上内边距。 | 1 |
Paged Media 属性
属性 | 描述 | CSS |
---|---|---|
fit | 示意如何对width和height属性均不是auto的被替换元素进行缩放。 | 3 |
fit-position | 定义盒内对象的对齐方式。 | 3 |
image-orientation | 规定用户代理应用于图像的顺时针方向旋转。 | 3 |
page | 规定元素应该被显示的页面特定类型。 | 3 |
size | 规定页面内容包含框的尺寸和方向。 | 3 |
CSS 定位属性(Positioning)
属性 | 描述 | CSS |
---|---|---|
bottom | 设置定位元素下外边距边界与其包含块下边界之间的偏移。 | 2 |
clear | 规定元素的哪一侧不允许其他浮动元素。 | 1 |
clip | 剪裁绝对定位元素。 | 2 |
cursor | 规定要显示的光标的类型(形状)。 | 2 |
display | 规定元素应该生成的框的类型。 | 1 |
float | 规定框是否应该浮动。 | 1 |
left | 设置定位元素左外边距边界与其包含块左边界之间的偏移。 | 2 |
overflow | 规定当内容溢出元素框时发生的事情。 | 2 |
position | 规定元素的定位类型。 | 2 |
right | 设置定位元素右外边距边界与其包含块右边界之间的偏移。 | 2 |
top | 设置定位元素的上外边距边界与其包含块上边界之间的偏移。 | 2 |
vertical-align | 设置元素的垂直对齐方式。 | 1 |
visibility | 规定元素是否可见。 | 2 |
z-index | 设置元素的堆叠顺序。 | 2 |
CSS 打印属性(Print)
属性 | 描述 | CSS |
---|---|---|
orphans | 设置当元素内部发生分页时必须在页面底部保留的最少行数。 | 2 |
page-break-after | 设置元素后的分页行为。 | 2 |
page-break-before | 设置元素前的分页行为。 | 2 |
page-break-inside | 设置元素内部的分页行为。 | 2 |
widows | 设置当元素内部发生分页时必须在页面顶部保留的最少行数。 | 2 |
CSS 表格属性(Table)
属性 | 描述 | CSS |
---|---|---|
border-collapse | 规定是否合并表格边框。 | 2 |
border-spacing | 规定相邻单元格边框之间的距离。 | 2 |
caption-side | 规定表格标题的位置。 | 2 |
empty-cells | 规定是否显示表格中的空单元格上的边框和背景。 | 2 |
table-layout | 设置用于表格的布局算法。 | 2 |
CSS 文本属性(Text)
属性 | 描述 | CSS |
---|---|---|
color | 设置文本的颜色。 | 1 |
direction | 规定文本的方向 / 书写方向。 | 2 |
letter-spacing | 设置字符间距。 | 1 |
line-height | 设置行高。 | 1 |
text-align | 规定文本的水平对齐方式。 | 1 |
text-decoration | 规定添加到文本的装饰效果。 | 1 |
text-indent | 规定文本块首行的缩进。 | 1 |
text-shadow | 规定添加到文本的阴影效果。 | 2 |
text-transform | 控制文本的大小写。 | 1 |
unicode-bidi | 设置文本方向。 | 2 |
white-space | 规定如何处理元素中的空白。 | 1 |
word-spacing | 设置单词间距。 | 1 |
hanging-punctuation | 规定标点字符是否位于线框之外。 | 3 |
punctuation-trim | 规定是否对标点字符进行修剪。 | 3 |
text-align-last | 设置如何对齐最后一行或紧挨着强制换行符之前的行。 | 3 |
text-emphasis | 向元素的文本应用重点标记以及重点标记的前景色。 | 3 |
text-justify | 规定当 text-align 设置为 "justify" 时所使用的对齐方法。 | 3 |
text-outline | 规定文本的轮廓。 | 3 |
text-overflow | 规定当文本溢出包含元素时发生的事情。 | 3 |
text-shadow | 向文本添加阴影。 | 3 |
text-wrap | 规定文本的换行规则。 | 3 |
word-break | 规定非中日韩文本的换行规则。 | 3 |
word-wrap | 允许对长的不可分割的单词进行分割并换行到下一行。 | 3 |
2D/3D 转换属性(Transform)
属性 | 描述 | CSS |
---|---|---|
transform | 向元素应用 2D 或 3D 转换。 | 3 |
transform-origin | 允许你改变被转换元素的位置。 | 3 |
transform-style | 规定被嵌套元素如何在 3D 空间中显示。 | 3 |
perspective | 规定 3D 元素的透视效果。 | 3 |
perspective-origin | 规定 3D 元素的底部位置。 | 3 |
backface-visibility | 定义元素在不面对屏幕时是否可见。 | 3 |
过渡属性(Transition)
属性 | 描述 | CSS |
---|---|---|
transition | 简写属性,用于在一个属性中设置四个过渡属性。 | 3 |
transition-property | 规定应用过渡的 CSS 属性的名称。 | 3 |
transition-duration | 定义过渡效果花费的时间。 | 3 |
transition-timing-function | 规定过渡效果的时间曲线。 | 3 |
transition-delay | 规定过渡效果何时开始。 | 3 |
用户界面属性(User-interface)
属性 | 描述 | CSS |
---|---|---|
appearance | 允许您将元素设置为标准用户界面元素的外观 | 3 |
box-sizing | 允许您以确切的方式定义适应某个区域的具体内容。 | 3 |
icon | 为创作者提供使用图标化等价物来设置元素样式的能力。 | 3 |
nav-down | 规定在使用 arrow-down 导航键时向何处导航。 | 3 |
nav-index | 设置元素的 tab 键控制次序。 | 3 |
nav-left | 规定在使用 arrow-left 导航键时向何处导航。 | 3 |
nav-right | 规定在使用 arrow-right 导航键时向何处导航。 | 3 |
nav-up | 规定在使用 arrow-up 导航键时向何处导航。 | 3 |
outline-offset | 对轮廓进行偏移,并在超出边框边缘的位置绘制轮廓。 | 3 |
resize | 规定是否可由用户对元素的尺寸进行调整。 | 3 |
Serif 字体
font-family | 示例文本 |
---|---|
Georgia, serif | This is a headingThis is a paragraph |
'Palatino Linotype', 'Book Antiqua', Palatino, serif | This is a headingThis is a paragraph |
'Times New Roman', Times, serif | This is a headingThis is a paragraph |
Sans-Serif 字体
font-family | 示例文本 |
---|---|
Arial, Helvetica, sans-serif | This is a headingThis is a paragraph |
'Arial Black', Gadget, sans-serif | This is a headingThis is a paragraph |
'Comic Sans MS', cursive, sans-serif | This is a headingThis is a paragraph |
Impact, Charcoal, sans-serif | This is a headingThis is a paragraph |
'Lucida Sans Unicode', 'Lucida Grande', sans-serif | This is a headingThis is a paragraph |
Tahoma, Geneva, sans-serif | This is a headingThis is a paragraph |
'Trebuchet MS', Helvetica, sans-serif | This is a headingThis is a paragraph |
Verdana, Geneva, sans-serif | This is a headingThis is a paragraph |
Monospace 字体
font-family | 示例文本 |
---|---|
'Courier New', Courier, monospace | This is a headingThis is a paragraph |
'Lucida Console', Monaco, monospace | This is a headingThis is a paragraph |
根据十六进制值排序
所有浏览器都支持的颜色名
尺寸
单位 | 描述 |
---|---|
% | 百分比 |
in | 英寸 |
cm | 厘米 |
mm | 毫米 |
em | 1em 等于当前的字体尺寸。 2em 等于当前字体尺寸的两倍。 例如,如果某元素以 12pt 显示,那么 2em 是24pt。 在 CSS 中,em 是非常有用的单位,因为它可以自动适应用户所使用的字体。 |
ex | 一个 ex 是一个字体的 x-height。 (x-height 通常是字体尺寸的一半。) |
pt | 磅 (1 pt 等于 1/72 英寸) |
pc | 12 点活字 (1 pc 等于 12 点) |
px | 像素 (计算机屏幕上的一个点) |
颜色
单位 | 描述 |
---|---|
(颜色名) | 颜色名称 (比如 red) |
rgb(x,x,x) | RGB 值 (比如 rgb(255,0,0)) |
rgb(x%, x%, x%) | RGB 百分比值 (比如 rgb(100%,0%,0%)) |
#rrggbb | 十六进制数 (比如 #ff0000) |
CSS2 听觉参考
W3C : "W3C" 列的数字显示出属性由哪个 CSS 标准定义(CSS1 还是 CSS2)。
属性 | 描述 | 值 | W3C |
---|---|---|---|
azimuth | Sets where the sound/voices should come from (horizontally) |
| 2 |
cue | A shorthand property for setting the cue-before and cue-after properties in one declaration |
| 2 |
cue-after | Specifies a sound to be played after speaking an element's content to delimit it from other |
| 2 |
cue-before | Specifies a sound to be played before speaking an element's content to delimit it from other |
| 2 |
elevation | Sets where the sound/voices should come from (vertically) |
| 2 |
pause | A shorthand property for setting the pause-before and pause-after properties in one declaration |
| 2 |
pause-after | Specifies a pause after speaking an element's content |
| 2 |
pause-before | Specifies a pause before speaking an element's content |
| 2 |
pitch | Specifies the speaking voice |
| 2 |
pitch-range | Specifies the variation in the speaking voice. (Monotone voice or animated voice?) |
| 2 |
play-during | Specifies a sound to be played while speaking an element's content |
| 2 |
richness | Specifies the richness in the speaking voice. (Rich voice or thin voice?) |
| 2 |
speak | Specifies whether content will render aurally |
| 2 |
speak-header | Specifies how to handle table headers. Should the headers be spoken before every cell, or only before a cell with a different header than the previous cell |
| 2 |
speak-numeral | Specifies how to speak numbers |
| 2 |
speak-punctuation | Specifies how to speak punctuation characters |
| 2 |
speech-rate | Specifies the speed of the speaking |
| 2 |
stress | Specifies the "stress" in the speaking voice |
| 2 |
voice-family | A prioritized list of voice family names that contain specific voices |
| 2 |
volume | Specifies the volume of the speaking |
| 2 |