CSS to keep element at “fixed” position on screen

后端 未结 11 1439
旧巷少年郎
旧巷少年郎 2020-12-04 23:22

I\'m looking for a trick to create a \"fixed\" HTML object on the browser screen using CSS. I want it to stay in the same position all the time, even when the user scrolls t

11条回答
  •  悲&欢浪女
    2020-12-05 00:08

    In order to keep floating text in the same location over an image when changing browser zoom, I used this CSS:

    position: absolute;
    margin-top: -18%
    

    I think the % instead of fixed pixels is what does it. Cheers!

提交回复
热议问题