day6 固定定位 fixed
<html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>固定定位</title> <style> div { width: 200px; height: 200px; background-color: pink; position: fixed; /* 认死理型的 */ left: 0; top: 100px; /* 固定定位是一个变异的绝对定位 */ } </style> </head> <body> <div>ad</div> <p>我是文字</p> <p>我是文字</p> <p>我是文字</p> <p>我是文字</p> <p>我是文字</p> <p>我是文字</p> <p>我是文字</p> <p>我是文字</p> <p>我是文字</p> <p>我是文字</p> <p>我是文字</p> <p>我是文字</p> <p>我是文字</p> <p>我是文字</p> <p>我是文字</p> <p>我是文字</p> <p>我是文字</p> <p>我是文字</p> <p>我是文字</p> </body> </html>
加油!