样式
大小
width:600px宽度
height:600px高度
背景(background)
background-color:颜色 背景颜色
background-image:图片地址 背景图片
background-repeat:no-repeat 背景图片平铺方式
background-position :right bottom 背景图片位置
background-size:200px 200px 背景图大小
文字(font)
font-family:字体 选择字体
font-size:12/14/16px 字体大小,网页字体常用大小分为12px、14px、16px
font-style:italic 相当于<i>字体倾斜
font-weight:bold 相当于<b>字体加粗
color:颜色 选择字体的颜色
text-decoration:underline下划线 overline上划线 line-through删除划线
none没有划线,用来去掉超链接的下划线
对齐方式
text-align:center 横向
vertical-align:bottom 垂直(与行高同用)
line-height: 300px 行高
text-indent: 缩进单位像素
边距/间距
margin 外边距 顺时针设置
padding 内边距 顺时针设置,内边距设置后对应元素会相应的变大
<a>/<span>标签的字体大小默认无法改变
margin:0xp auto;padding:0px 可以把每个元素之间的间距、边距都去掉
增加auto可以使所有div都居中
位置
position
position:absolute 绝对位置(相对于浏览器或者是父级,如果是父级那么父级也要是绝对定位)
position:fixed 相对于浏览器边框位置固定
position:relative 相对于自身应该出现的位置移动
设置绝对位置后可以直接使用top/right/bottom/left
流
float-right 从右往左
float-left 从左往右
style=“clear:both” 清流
display:inline-block 用于显示超链接spa
z-index:100 分层 值越大越靠上
显示和隐藏
display/visibility/overflow
display:显示block
隐藏none不占位置,隐藏后所站位置消失
visibility:显示visible
隐藏hidding占位置,只是隐藏内容,原本内容的位置还在
overflow:超出的范围隐藏
透明:opacity:0.5;-moz-opacity:0.5;filter:alpha(opacity=50)
圆角:border-radius:5px;
阴影:box-shadow:0 0 5px white;