Style常用属性
来源:动视网
责编:小OO
时间:2025-10-02 19:18:55
Style常用属性
Style常用属性常用属性属性名描述Color设置元素的前景色(字体颜色)Width设置元素宽度Height设置元素高度line-height设置行间距vertical-align设置内容的垂直对齐方式边框属性属性名描述Border设置元素边框风格Border-style设置元素边框风格Border-width设置元素边框宽度Border-color设置元素边框颜色Border-bottom设置元素下边框风格Border-bottom-style设置元素下边框风格Border-bottom-w
导读Style常用属性常用属性属性名描述Color设置元素的前景色(字体颜色)Width设置元素宽度Height设置元素高度line-height设置行间距vertical-align设置内容的垂直对齐方式边框属性属性名描述Border设置元素边框风格Border-style设置元素边框风格Border-width设置元素边框宽度Border-color设置元素边框颜色Border-bottom设置元素下边框风格Border-bottom-style设置元素下边框风格Border-bottom-w
Style常用属性
常用属性
| 属性名 | 描述 |
| Color | 设置元素的前景色(字体颜色) |
| Width | 设置元素宽度 |
| Height | 设置元素高度 |
| line-height | 设置行间距 |
| vertical-align | 设置内容的垂直对齐方式 |
边框属性
| 属性名 | 描述 |
| Border | 设置元素边框风格 |
| Border-style | 设置元素边框风格 |
| Border-width | 设置元素边框宽度 |
| Border-color | 设置元素边框颜色 |
| Border-bottom | 设置元素下边框风格 |
| Border-bottom-style | 设置元素下边框风格 |
| Border-bottom-width | 设置元素下边框宽度 |
| Border-bottom-color | 设置元素下边框颜色 |
| Border-collapse | 设置元素边框是否合并 |
| Border-spacing | 设置元素边框之间的距离 |
| border-radius | 设置元素的圆角边框效果 |
注:同时存在border-left、border-top及border-right属性名,因作用相似不在重复
背景属性
| 属性名 | 描述 |
| Background | 设置元素背景风格 |
| Background-color | 设置元素背景颜色 |
| Background-image | 设置元素背景图片 |
| Background-repeat | 设置元素背景平铺效果 |
| Background-attachment | 设置元素背景滚动效果 |
| Background-position | 设置元素背景图片位置 |
文本属性
| 属性名 | 描述 |
| text-decoration | 设置文本内容的修饰 |
| text-align | 设置文本内容的对齐方式 |
| text-indent | 设置文本的缩进 |
| text-shadow | 设置文本的投影及模糊效果 |
| text-transform | 设置文本的首字符大写 |
字体属性
| 属性名 | 描述 |
| font-family | 设置字体名称 |
| font-size | 设置字体的大小 |
| font-style | 设置字体的风格,如:斜体 |
| font-weight | 设置字体的粗细程度 |
| font-variant | 设置字体为小型大写字体 |
| font-stretch | 设置字体的拉伸及变形 |
列表属性
| 属性名 | 描述 |
| list-style-type | 设置列表风格类型 |
| list-style-image | 设置列表风格图片 |
| list-style-position | 设置列表图片位置 |
填充效果
| 属性名 | 描述 |
| padding | 设置元素的内填充距离 |
| padding-left | 设置元素的左内填充距离 |
| Padding-top | 设置元素的上内填充距离 |
| Padding-right | 设置元素的右内填充距离 |
| Padding-bottom | 设置元素的下内填充距离 |
| Margin | 设置元素的外填充距离 |
| Margin-left | 设置元素的左外填充距离 |
| Margin-top | 设置元素的上外填充距离 |
| Margin-right | 设置元素的右外填充距离 |
| Margin-bottom | 设置元素的下外填充距离 |
其他属性
| 属性名 | 描述 |
| Position | 设置元素位置(定位) |
| Left | 设置元素的x轴坐标 |
| Top | 设置元素的y轴坐标 |
| Right | 设置元素右侧的x轴坐标 |
| Bottom | 设置元素底边y轴坐标 |
| Z-index | 设置元素的层叠位置 |
| Float | 设置元素的浮动效果 |
| Clear | 清除元素的浮动效果 |
| Overflow | 设置元素的溢出效果 |
| Display | 设置元素的显示方式 |
伪类
| 属性名 | 描述 |
| :Link | 未访问的元素样式 |
| :hover | 鼠标悬浮时元素样式 |
| :visited | 访问后的元素样式 |
| :active | 正在被访问元素的样式 |
Style常用属性
Style常用属性常用属性属性名描述Color设置元素的前景色(字体颜色)Width设置元素宽度Height设置元素高度line-height设置行间距vertical-align设置内容的垂直对齐方式边框属性属性名描述Border设置元素边框风格Border-style设置元素边框风格Border-width设置元素边框宽度Border-color设置元素边框颜色Border-bottom设置元素下边框风格Border-bottom-style设置元素下边框风格Border-bottom-w