Translate X and Y percentage values based on elements height and width?

前端 未结 9 1781
情歌与酒
情歌与酒 2020-12-08 03:29

Translating an elements Y axis 50% will move it down 50% of its own height, not 50% of the parents height as I would expect. How do I tell a translating element to base it\'

9条回答
  •  被撕碎了的回忆
    2020-12-08 04:21

    You can use vw and vh to translate based on the viewport size

    @keyframes bubbleup {
      0% {
        transform: translateY(100vh);
      }
    
      100% {
        transform: translateY(0vh);
      }
    }
    

提交回复
热议问题