位置:
position:
top和left来控制否则会使下一个div错位
absolute绝对位置
相对于父级元素(浏览器,绝对定位的上级)
<style type="text/css"> #a{ width:200px; height:200px; background-color:#F00; position:absolute; bottm:100px; left:100px; } #b{ width:500px; height:500px; background-color:#FF0; } #c{ width:100px; height:100px; background-color:#00F; position:absolute; top:20px;} </style>
fixed固定:
相对于浏览器边框位置固定
top
bottom
left
right
relative相对位置
相对于原来位置移动,该元素外层没有固定位置的元素,相对于浏览器边框位置
top
距离上边多少像素
right
距离右边多少像素
bottom
距离下边多少像素
left
距离左边多少像素
流:float
left
向左流
right
向右流
clean
both清流:上面用完流,下面要加内容,可以在下面用清流,防止下面内容往上跑
<style type="text/css"> .a{ width:300px; height:300px; background-color:#F00; float:left; margin-right:10px; } </style>![]()
Z-index分层
值越大越靠上
只有position有效果
display:
cursor:pointer鼠标光标变手指
显示block和隐藏none,none不占位置
visibility
显示visible和隐藏hidden,hidden占位置
overflow
超出隐藏hidden超出滚动scroll
透明
opacity:0.5;-moz-opacity:0.5;filter:alpha(opacit=50)
圆角
border-radius:5px
阴影
box-shadow:0 0 5px white;

浙公网安备 33010602011771号