纯CSS实现吸顶效果

position的属性有哪些?

{
  position: static;
  position: relative;
  position: absolute;
  position: fixed;

  position: inherit;
  position: initial;
  position: unset;

}

还有一个position的属性值:position: sticky

position: sticky;粘性定位,是相对定位和固定定位的混合。元素在跨越特定阈值前为相对定位,之后为固定定位。著作权归作者所有。

注意:

1、position: sticky还是一个实验性的属性值。著作权归作者所有。

2、粘性定位的固定定位并不一定是position:fixed,只有目标元素的任意父元素都没有设置position:relative | absolute | fixed | sticky的情况下,才与position: fixed表现一样。而当其任一父元素设置了position:relative | absolute | fixed | sticky时,目标元素是相对于父元素的固定。

参考来源:http://ghmagical.com/article/page/id/3GkrXEZVxLHK

posted @ 2018-10-17 11:50  小九_66  阅读(5958)  评论(0编辑  收藏  举报