Overlap two centered elements using CSS flexbox

前端 未结 2 2000
北荒
北荒 2021-02-08 22:42

I\'m trying to absolutely center two elements in the middle of the page, with one behind the other. The intent is to have a page that is fully responsive with a circle in the mi

2条回答
  •  梦毁少年i
    2021-02-08 23:39

    Not sure if that'll do it, but you could simply add to your :after

    position: absolute;
    top   : 0;
    left  : 0;
    bottom: 0;
    right : 0;
    

    fiddle: http://jsfiddle.net/ccyd6xh1/

    Update that was a quick draft, and was not absolutely responsive. If you want the effect the really follow your sphere and its size, you should add the :after on the sphere element and not its container, and use % width and height (here the glow grows to 130% of the sphere size):

    http://jsfiddle.net/tjoo739y/

提交回复
热议问题