老师,这个固定定位不受父元素影响吗?这道题我不理解

来源:2-14 编程练习

qq_追梦永不止息_0

2020-04-27 12:11:26

<!DOCTYPE html>

<html>

 <head>

  <meta charset="utf-8">

  <title></title>

  <style>

   .per{

width: 300px;

height: 300px;

background-color: red;

position: absolute;

top: 100px;

left: 100px;

   }

   .son{

width: 100px;

height: 100px;

background-color: blue;

position: fixed;

right: 0px;

bottom: 0px;

   }

  </style>

 </head>

 <body>

  <div class="per">

   <div class="son"></div>

  </div>

 </body>

</html>


写回答

1回答

好帮手慕言

2020-04-27

同学你好,固定定位是参考窗口进行定位的。不受父元素定位的影响。类名为son的元素是相对于窗口进行定位的,right和bottom设置为0,就会在窗口的右下角显示。

如果我的回答帮到了你,欢迎采纳,祝学习愉快~

0

0 学习 · 40143 问题

查看课程