以下是CSS样式属性,属性按功能分为颜色与背景、文字与字体、Flex弹性布局、Grid布局、定位、盒模型、边框效果、阴影与滤镜、动画与过渡、交互性(伪类、伪元素等)。

一、颜色与背景

属性

说明

color

设置文本颜色

opacity

设置元素的不透明度(0-1)

background

复合属性,设置背景颜色、图片、位置等

background-color

设置背景颜色

background-Image

设置背景图片

background-size

设置背景图片大小(cover、contain、auto)

background-position

设置背景图片的位置

background-repeat

设置背景图片的重复方式(repeat、no-repeat)

background-attachment

设置图片是否随页面滚动(scroll、fixed)

二、文字与字体

属性

说明

font-family

设置字体

font-size

设置字体大小

font-weight

设置字体粗细

font-style

设置字体样式

font-variant

小型大写字母

line-height

行高

letter-spacing

字符间距

word-spacing

单词间距

text-align

文本对齐

text-decoration

文本装饰

text-transform

文本转换

text-indent

首行缩进

text-overflow