常见CSS属性

一、布局类 (Layout)

属性作用描述常用值示例
display定义元素显示类型blockinlineflexgridnone
position定位方式staticrelativeabsolutefixedsticky
top/right/bottom/left定位偏移量10px50%auto
float元素浮动方向leftrightnone
clear清除浮动影响bothleftright
z-index堆叠顺序1-1

Flexbox 布局 | flex-direction | 主轴方向 | row, column, row-reverse | | flex-wrap | 换行方式 | nowrap, wrap | | justify-content | 主轴对齐方式 | flex-start, center, space-between | | align-items | 交叉轴对齐 | stretch, center, baseline |

Grid 布局 | grid-template-columns | 定义网格列宽 | 100px 1fr, repeat(3, 1fr) | | grid-template-rows | 定义网格行高 | auto, minmax(100px, auto) | | grid-gap | 网格间距 | 10px 20px | | grid-column/grid-row | 项目位置 | 1 / 3, span 2 |

二、盒模型 (Box Model)

属性作用描述常用值示例
width/height内容区尺寸100px50%auto
padding内边距10px 5px1em 2em 3em
margin外边距auto10%0 20px
border边框简写1px solid #000
box-sizing盒模型计算方式content-boxborder-box

三、排版类 (Typography)

属性作用描述常用值示例
font-family字体类型'Arial', sans-serif
font-size字号16px1.2remlarger
font-weight字重normalbold700
line-height行高1.524px
text-align水平对齐leftcenterjustify
text-decoration文本装饰underlineline-through none
text-transform文本大小写转换uppercasecapitalize
letter-spacing字符间距2px-0.1em
white-space空白处理方式normalnowrappre

四、视觉效果 (Visual Effects)

属性作用描述常用值示例
background背景简写#fff url(bg.jpg) no-repeat center
background-color背景颜色rgba(255,0,0,0.5)
background-image背景图片url('image.jpg')linear-gradient(...)
border-radius圆角半径10px50%
box-shadow盒子阴影2px 2px 5px rgba(0,0,0,0.3)
opacity不透明度0.5 (50% 透明)
transform2D/3D变换rotate(45deg)translateX(100px)
filter视觉滤镜blur(5px)grayscale(100%)

五、动画与过渡 (Animation)

属性作用描述常用值示例
transition过渡效果all 0.3s ease-in
animation动画简写slide 2s infinite
@keyframes定义关键帧动画(需配合动画名称使用)

六、响应式设计 (Responsive)

属性作用描述常用值示例
@media媒体查询条件(max-width: 768px)
min-width/max-width媒体查询尺寸范围600px1024px

七、其他重要属性

属性作用描述常用值示例
cursor鼠标指针样式pointerhelpnot-allowed
overflow溢出内容处理visiblehiddenscroll
visibility元素可见性visiblehidden
clip-path裁剪路径circle(50%)polygon(...)
will-change性能优化提示transformopacity

八、完整学习资源

获取完整的属性列表和最新规范,推荐访问:

  1. MDN Web Docshttps://developer.mozilla.org/en-US/docs/Web/CSS/Reference
  2. CSS Tricks Almanachttps://css-tricks.com/almanac/
  3. W3C CSS 规范https://www.w3.org/Style/CSS/
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值