>### 相對定位:
~~~
就是元素在頁面上的正常位置
通過left,top可以改變它的位置
~~~
>### 絕對定位:
~~~
1.絕對定位元素的位置是相對于最近的給了定位的父元素
2.如果上級元素沒有定位,那么它的位置相對于整個html頁面
~~~
~~~
<style>
.parent{
width:200px;
height:200px;
position: relative;
top:50px;
left:50px;
background: red;
}
.child{
width:50px;
height:50px;
background: blue;
position: absolute;
top:100px;
left:100px;
/* right: 0px;
bottom: 0px; */
}
</style>
</head>
<body>
<div class="parent">
<div class="child"></div>
~~~
- html-css
- 第一節 外部樣式表
- 第二節 元素選擇器
- 第三章 盒子模型
- 第四章 html標簽的分類
- 第五章 css選擇器
- 第六章 權重
- 第七章 css基本樣式
- 第一節 背景
- 第二節 文本
- 第三節 字體
- 第四節 鏈接
- 第五節 列表(針對ul)
- 第六節 邊框
- 第七節 簡單表格
- 第八節 nvvm
- 第九節 跨越列的表格
- 第十節 跨越行的表格
- 第十一節 有間隔的表格
- 第十二節 opacity透明度
- 第八章 css樣式的繼承
- 進階教程
- 1.flex教程
- flex補充1
- flex補充2
- 2.grid布局
- css
- 第一節 box-sizing
- 第二節 float
- 第三節 position
- 第四節 導航欄
- iconfont的使用
- 第五節 搜索功能的實現