>相對定位
- 1相對定位是相對自己的原本的位置定位
position:relative;
>絕對定位
- 2在父級的基礎上的絕對的位置(與其給了定位的離得最近的父級)
position:absolutive;
- 3div懸浮在屏幕上
position:fixed;
- 4搜索框格式
<div class="search">
<input>
<button></button>
</div>
- 5 定位垂直居中

~~~
.parent{
position: relative;
width:300px;
height:300px;
background:red;
}
.child{
position:absolute;
width:50px;
height:50px;
background:green;
left:50%;子元素left,top值給百分比,是相對于父元素的width,height而言的
top:50%;
margin-left:-25px;(height的一半)
margin-top: -25px;
}
~~~
- 6弧度
border-radius
- 7堆疊順序
z-index
設置給了absolute定位元素的堆疊順序
數字越大,順序越前,越先顯示
- 8設置盒子尺寸
div{box-sizing: border-box;}