css常用属性

一、文字段落

1.长度值

单位长度:em,ex,pc,px,pt,mm,cm,in。

百分比长度:XX%可取正负

2.文字控制

font:风格 变形 加粗 大小/行高 族科

font-faminly:族名font-style:normal/italic/oblique

font-variant:normal/small-caps

font-weight:normal/bool/100/200

font-size:em/px(会覆盖前面的line-height

3.文本控制

text-align:left/right/center/justify

text-indent 长度(文本块中首行缩进)

text-spacing 长度

veitical-align:百分比/sub/top/middle垂直对齐

 line-height:数值百分比/normal

text-transform:none/captalize/uppercase/lowercase(控制字母大小写)

text-decoration:underline/overline/line-through/blink/none

二、颜色背景

1.颜色表示方式

RGB()数值或者百分比rgba()数值百分比表示颜色透明色

十六进制:#rrggbb简写#rgb

2.控制颜色

color:字体颜色

background-color:背景颜色

3.控制背景

background-image:url()

background-repeat:repeat/repeat-x/repeat-y/no-repeat

backgorund-attachment:scroll/fixed(设置背景图片是固定还是滚动)

background-position:数值百分比/top/bottom/center/left/right(取2值)

backgorund:背景色 背景图 平铺 固定 位置

三、网页元素格式化

1.边界设置

margin-top margin-right margin-bottom margin-left

margin:上右下左(顺时针)

2.边框设置

border-top-width:数值(非负)

border-数值 上右下左

border-color:上右下左

border-style:上右下左

border:宽度 样式 颜色(四边不能飞开定义)

3.填充距设置

padding-top:数值

padding:上右下左

4.宽度和高度

数值

height:数值

5.浮动

float:left/right

clear:none/left/right清除浮动,浮动找浮动,不浮动找不浮动

6.鼠标样式

cursor:auto/

7.超级链接

a:link 普通

a:visited已访问

a:hover悬停

a:active活动(为了产生效果,按照顺序:link.visited.hover.active)

四、定位网页元素

position:absolute/relative/static

left:

top:

height:

clip:rect(上右下左)剪切图形,显示矩形范围内的

visibility:visible/hidden/inherit(从父元素继承visibility)

overflow:visible/hidden/scroll/auto

z-index:确定几个重叠盒子的图层,高的在上

原文地址:https://www.cnblogs.com/wxlyq/p/5050988.html