当前位置: 首页 > 网络学院 > 网页制作基础教程 > CSS > CSS2 参考资料
The links in the "Property" column point to more useful information about the specific property.
在"属性"列中的连接可以提供更详尽的属性信息。
支持的浏览器: IE: Internet Explorer, F: Firefox, N: Netscape.
W3C: The number in the "W3C" column indicates in which CSS recommendation the property is defined (CSS1 or CSS2).
在W3C栏目下显示的数字为CSS版本(CSS1或CSS2)
属性 | 描述 | 值 | IE | F | N | W3C |
---|---|---|---|---|---|---|
background | A shorthand property for setting all background properties in one declaration 一个速记属性来用一个声明设置所有背景属性 | background-color background-image background-repeat background-attachment background-position | 4 | 1 | 6 | 1 |
background-attachment | Sets whether a background image is fixed or scrolls with the rest of the page 设置背景图片为固定还是滚屏的 | scroll fixed | 4 | 1 | 6 | 1 |
background-color | Sets the background color of an element 为一元素设置背景颜色 | color-rgb color-hex color-name transparent | 4 | 1 | 4 | 1 |
background-image | Sets an image as the background 设置一图片做为背景 | url none | 4 | 1 | 4 | 1 |
background-position | Sets the starting position of a background image 设置背景图片的起始位置 | top left top center top right center left center center center right bottom left bottom center bottom right x-% y-% x-pos y-pos | 4 | 1 | 6 | 1 |
background-repeat | Sets if/how a background image will be repeated 如果背景有重复图片的话就用这个设置 | repeat repeat-x repeat-y no-repeat | 4 | 1 | 4 | 1 |
属性 | 描述 | 值 | IE | F | N | W3C |
---|---|---|---|---|---|---|
border | A shorthand property for setting all of the properties for the four borders in one declaration 设置四边属性的快速声明 | border-width border-style border-color | 4 | 1 | 4 | 1 |
border-bottom | A shorthand property for setting all of the properties for the bottom border in one declaration 设置底部边框属性的快速声明 | border-bottom-width border-style border-color | 4 | 1 | 6 | 1 |
border-bottom-color | Sets the color of the bottom border 设置底部边框颜色 | border-color | 4 | 1 | 6 | 2 |
border-bottom-style | Sets the style of the bottom border 设置低部边框样式 | border-style | 4 | 1 | 6 | 2 |
border-bottom-width | Sets the width of the bottom border 设置底部边框宽度 | thin medium thick length | 4 | 1 | 4 | 1 |
border-color | Sets the color of the four borders, can have from one to four colors 设置四边颜色 | color | 4 | 1 | 6 | 1 |
border-left | A shorthand property for setting all of the properties for the left border in one declaration 设置左边框属性 | border-left-width border-style border-color | 4 | 1 | 6 | 1 |
border-left-color | Sets the color of the left border 设置左边框颜色 | border-color | 4 | 1 | 6 | 2 |
border-left-style | Sets the style of the left border 设置左边框样式 | border-style | 4 | 1 | 6 | 2 |
border-left-width | Sets the width of the left border 设置左边框宽度 | thin medium thick length | 4 | 1 | 4 | 1 |
border-right | A shorthand property for setting all of the properties for the right border in one declaration 设置右边框所有属性 | border-right-width border-style border-color | 4 | 1 | 6 | 1 |
border-right-color | Sets the color of the right border 设置右边框颜色 | border-color | 4 | 1 | 6 | 2 |
border-right-style | Sets the style of the right border 设置右边框样式 | border-style | 4 | 1 | 6 | 2 |
border-right-width | Sets the width of the right border 设置右边框宽度 | thin medium thick length | 4 | 1 | 4 | 1 |
border-style | Sets the style of the four borders, can have from one to four styles 设置四边样式 | none hidden dotted dashed solid double groove ridge inset outset | 4 | 1 | 6 | 1 |
border-top | A shorthand property for setting all of the properties for the top border in one declaration 设置顶边所有属性 | border-top-width border-style border-color | 4 | 1 | 6 | 1 |
border-top-color | Sets the color of the top border 设置顶边颜色 | border-color | 4 | 1 | 6 | 2 |
border-top-style | Sets the style of the top border 设置顶边样式 | border-style | 4 | 1 | 6 | 2 |
border-top-width | Sets the width of the top border 设置顶边宽度 | thin medium thick length | 4 | 1 | 4 | 1 |
border-width | A shorthand property for setting the width of the four borders in one declaration, can have from one to four values 设置四边宽度 | thin medium thick length | 4 | 1 | 4 | 1 |
属性 | 描述 | 值 | IE | F | N | W3C |
---|---|---|---|---|---|---|
clear | Sets the sides of an element where other floating elements are not allowed 设置一元素的两边都不允许有其他元素进行浮动 | left right both none | 4 | 1 | 4 | 1 |
cursor | Specifies the type of cursor to be displayed 指定游标所显示的类型 | url auto crosshair default pointer move e-resize ne-resize nw-resize n-resize se-resize sw-resize s-resize w-resize text wait help | 4 | 1 | 6 | 2 |
display | Sets how/if an element is displayed 设置元素(是否/怎样)显示 | none inline block list-item run-in compact marker table inline-table table-row-group table-header-group table-footer-group table-row table-column-group table-column table-cell table-caption | 4 | 1 | 4 | 1 |
float | Sets where an image or a text will appear in another element 设置在另一元素里的图片或是文字将在哪个位置显示 | left right none | 4 | 1 | 4 | 1 |
position | Places an element in a static, relative, absolute or fixed position 将元素以static, relative, absolute或是固定的方式进行定位 | static relative absolute fixed | 4 | 1 | 4 | 2 |
visibility | Sets if an element should be visible or invisible 设置元素显示或是不显示 | visible hidden collapse | 4 | 1 | 6 | 2 |
属性 | 描述 | 值 | IE | F | N | W3C |
---|---|---|---|---|---|---|
height | Sets the height of an element 设置元素的高度 | auto length % | 4 | 1 | 6 | 1 |
line-height | Sets the distance between lines 设置两行间的距离(行高) | normal number length % | 4 | 1 | 4 | 1 |
max-height | Sets the maximum height of an element 设置元素的最大高度 | none length % | - | 1 | 6 | 2 |
max-width | Sets the maximum width of an element 设置元素的最大宽度 | none length % | - | 1 | 6 | 2 |
min-height | Sets the minimum height of an element 设置元素的最小高度 | length % | - | 1 | 6 | 2 |
min-width | Sets the minimum width of an element 设置元素的最小宽度 | length % | - | 1 | 6 | 2 |
width | Sets the width of an element 设置元素的宽度 | auto % length | 4 | 1 | 4 | 1 |
属性 | 描述 | 值 | IE | F | N | W3C |
---|---|---|---|---|---|---|
font | A shorthand property for setting all of the properties for a font in one declaration 快速设置所有字体属性的声明 | font-style font-variant font-weight font-size/line-height font-family caption icon menu message-box small-caption status-bar | 4 | 1 | 4 | 1 |
font-family | A prioritized list of font family names and/or generic family names for an element 一份为元素准备的字体系列优先列表 | family-name generic-family | 3 | 1 | 4 | 1 |
font-size | Sets the size of a font 设置字体大小 | xx-small x-small small medium large x-large xx-large smaller larger length % | 3 | 1 | 4 | 1 |
font-size-adjust | Specifies an aspect value for an element that will preserve the x-height of the first-choice font 指定首选字体x高度 | none number | - | - | - | 2 |
font-stretch | Condenses or expands the current font-family 当前字体系列的合并或扩展 | normal wider narrower ultra-condensed extra-condensed condensed semi-condensed semi-expanded expanded extra-expanded ultra-expanded | - | - | - | 2 |
font-style | Sets the style of the font 设置字体样式 | normal italic oblique | 4 | 1 | 4 | 1 |
font-variant | Displays text in a small-caps font or a normal font 让字体显示为小号或正常 | normal small-caps | 4 | 1 | 6 | 1 |
font-weight | Sets the weight of a font 设置字体的粗细 | normal bold bolder lighter 100 200 300 400 500 600 700 800 900 | 4 | 1 | 4 | 1 |
属性 | 描述 | 值 | IE | F | N | W3C |
---|---|---|---|---|---|---|
content | Generates content in a document. Used with the :before and :after pseudo-elements 通过使用 :before和 :after 伪元素 生成文档里的内容 | string url counter(name) counter(name, list-style-type) counters(name, string) counters(name, string, list-style-type) attr(X) open-quote close-quote no-open-quote no-close-quote | 1 | 6 | 2 | |
counter-increment | Sets how much the counter increments on each occurrence of a selector 设定当一个选择符(selector)发生时计数器增加的值。 | none identifier number | 2 | |||
counter-reset | Sets the value the counter is set to on each occurrence of a selector 将指定选择符(selector)的计数器复位 | none identifier number | 2 | |||
quotes | Sets the type of quotation marks 设置引用标记类型 | none string string | - | 1 | 6 | 2 |
属性 | 描述 | 值 | IE | F | N | W3C |
---|---|---|---|---|---|---|
list-style | A shorthand property for setting all of the properties for a list in one declaration 设置列表项目相关样式 | list-style-type list-style-position list-style-image | 4 | 1 | 6 | 1 |
list-style-image | Sets an image as the list-item marker 设置列表项目标记用图标表示 | none url | 4 | 1 | 6 | 1 |
list-style-position | Sets where the list-item marker is placed in the list 设置列表项目标志的位置 | inside outside | 4 | 1 | 6 | 1 |
list-style-type | Sets the type of the list-item marker 设置列表项目标志的类型 | none disc circle square decimal decimal-leading-zero lower-roman upper-roman lower-alpha upper-alpha lower-greek lower-latin upper-latin hebrew armenian georgian cjk-ideographic hiragana katakana hiragana-iroha katakana-iroha | 4 | 1 | 4 | 1 |
marker-offset | auto length | 1 | 7 | 2 |
属性 | 描述 | 值 | IE | F | N | W3C |
---|---|---|---|---|---|---|
margin | A shorthand property for setting the margin properties in one declaration 快速设置各边距属性 | margin-top margin-right margin-bottom margin-left | 4 | 1 | 4 | 1 |
Sets the bottom margin of an element 设置底部边距 | auto length % | 4 | 1 | 4 | 1 | |
Sets the left margin of an element 设置左部边距 | auto length % | 3 | 1 | 4 | 1 | |
Sets the right margin of an element 设置右部边距 | auto length % | 3 | 1 | 4 | 1 | |
margin-top | Sets the top margin of an element 设置上部边距 | auto length % | 3 | 1 | 4 | 1 |
属性 | 描述 | 值 | IE | F | N | W3C |
---|---|---|---|---|---|---|
outline | A shorthand property for setting all the outline properties in one declaration 设置所有线条轮廓 | outline-color outline-style outline-width | - | 1.5 | - | 2 |
outline-color | Sets the color of the outline around an element 设置线条轮廓的颜色 | color invert | - | 1.5 | - | 2 |
outline-style | Sets the style of the outline around an element 设置线条轮廓的类型 | none dotted dashed solid double groove ridge inset outset | - | 1.5 | - | 2 |
outline-width | Sets the width of the outline around an element 设置线条轮廓的宽度 | thin medium thick length | - | 1.5 | - | 2 |
属性 | 描述 | 值 | IE | F | N | W3C |
---|---|---|---|---|---|---|
padding | A shorthand property for setting all of the padding properties in one declaration 一种可针对所有填充属性进行一次声明的速记属性 | padding-top padding-right padding-bottom padding-left | 4 | 1 | 4 | 1 |
Sets the bottom padding of an element 设置元素的底填充 | length % | 4 | 1 | 4 | 1 | |
Sets the left padding of an element 设置元素的左填充 | length % | 4 | 1 | 4 | 1 | |
Sets the right padding of an element 设置元素的右填充 | length % | 4 | 1 | 4 | 1 | |
padding-top | Sets the top padding of an element 设置元素的顶部填充 | length % | 4 | 1 | 4 | 1 |
属性 | 描述 | 值 | IE | F | N | W3C |
---|---|---|---|---|---|---|
bottom | Sets how far the bottom edge of an element is above/below the bottom edge of the parent element 设置元素与其最近一个具有定位设置的父元素底边相关的位置 | auto % length | 5 | 1 | 6 | 2 |
clip | Sets the shape of an element. The element is clipped into this shape, and displayed 设置元素的可视区域。 | shape auto | 4 | 1 | 6 | 2 |
left | Sets how far the left edge of an element is to the right/left of the left edge of the parent element 设置元素与其最近一个具有定位设置的父元素左边相关的位置 | auto % length | 4 | 1 | 4 | 2 |
overflow | Sets what happens if the content of an element overflow its area 设置当对象的内容超过其指定高度及宽度时如何管理内容 | visible hidden scroll auto | 4 | 1 | 6 | 2 |
position | Places an element in a static, relative, absolute or fixed position 决定元素的定位方式 | static relative absolute fixed | 4 | 1 | 4 | 2 |
right | Sets how far the right edge of an element is to the left/right of the right edge of the parent element 设置对象与其最近一个具有定位设置的父对象右边相关的位置 | auto % length | 5 | 1 | 6 | 2 |
top | Sets how far the top edge of an element is above/below the top edge of the parent element 置对象与其最近一个具有定位设置的父对象顶边相关的位置 | auto % length | 4 | 1 | 4 | 2 |
vertical-align | Sets the vertical alignment of an element 设置元素垂直对齐方式 | baseline sub super top text-top middle bottom text-bottom length % | 4 | 1 | 4 | 1 |
z-index | Sets the stack order of an element 设置对象的层叠顺序 | auto number | 4 | 1 | 6 | 2 |
属性 | 描述 | 值 | IE | F | N | W3C |
---|---|---|---|---|---|---|
border-collapse | Sets the border model of a table 设置表格模型的边框 | collapse separate | 5 | 1 | 7 | 2 |
border-spacing | Sets the distance between the borders of adjacent cells (only for the "separated borders" model) 设置或检索当表格边框独立(例如当 border-collapse 属性等于 separate 时),行和单元格的边在横向和纵向上的间距。 | length length | - | 1 | 6 | 2 |
caption-side | Sets the position of the caption according to the table 设置或检索表格( table )的 caption 对象是在表格的那一边。它是和 caption 对象一起使用的属性。 | top bottom left right | - | 1 | 6 | 2 |
empty-cells | Sets whether cells with no visible content should have borders or not (only for the "separated borders" model) 设置或检索当表格的单元格无内容时,是否显示该单元格的边框。 只有当表格行和列的边框独立(例如当 border-collapse 属性等于 separate )时此属性才起作用。 | show hide | - | 1 | 6 | 2 |
table-layout | Sets the algorithm used to lay out the table 设置或检索表格的布局算法。 | auto fixed | 5 | 1 | 6 | 2 |
属性 | 描述 | 值 | IE | F | N | W3C |
---|---|---|---|---|---|---|
color | Sets the color of a text 设置文字颜色 | color | 3 | 1 | 4 | 1 |
direction | Sets the text direction 设置文字的书写方向 | ltr rtl | 6 | 1 | 6 | 2 |
letter-spacing | Increase or decrease the space between characters 字符间距 | normal length | 4 | 1 | 6 | 1 |
text-align | Aligns the text in an element 在一元素中怎么对齐文字(向左,向右..) | left right center justify | 4 | 1 | 4 | 1 |
text-decoration | Adds decoration to text 添加文字修饰(下划线等等) | none underline overline line-through blink | 4 | 1 | 4 | 1 |
text-indent | Indents the first line of text in an element 首行文字缩进 | length % | 4 | 1 | 4 | 1 |
text-shadow | none color length | |||||
text-transform | Controls the letters in an element 控制字母(大写,小写。。) | none capitalize uppercase lowercase | 4 | 1 | 4 | 1 |
unicode-bidi | normal embed bidi-override | 5 | 2 | |||
white-space | Sets how white space inside an element is handled 设置怎样给一元素控件留白 | normal pre nowrap | 5 | 1 | 4 | 1 |
word-spacing | Increase or decrease the space between words 单词间距 | normal length | 6 | 1 | 6 | 1 |
伪元素 | 意图 | IE | F | N | W3C |
---|---|---|---|---|---|
:first-letter | Adds special style to the first letter of a text 设置文字第一个字符的样式 | 5 | 1 | 8 | 1 |
:first-line | Adds special style to the first line of a text 为文字的第一行加上特殊样式 | 5 | 1 | 8 | 1 |
:before | Inserts some content before an element 在元素前插入一些内容 | 1.5 | 8 | 2 | |
:after | Inserts some content after an element 在元素后插入一些内容 | 1.5 | 8 | 2 |