CSS to keep element at “fixed” position on screen

后端 未结 11 1426
旧巷少年郎
旧巷少年郎 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-04 23:57

    You can do like this:

    #mydiv {
        position: fixed; 
        height: 30px; 
        top: 0; 
        left: 0; 
        width: 100%; 
    }
    

    This will create a div, that will be fixed on top of your screen. - fixed

提交回复
热议问题