首页 > 解决方案 > 保持按钮固定,但在体内

问题描述

body{
    max-width:1366px;
}

.gotop{
    position:fixed;
    right:9px;
    bottom:7px;
    cursor:pointer;
    width:25px;
}

gotop是一个在顶部滚动页面的按钮,它不能是可滚动的,即必须是fixed.

问题出在大于 1366 像素的显示器上。按钮离身体很远。

如何保持固定,但在体内?

标签: htmlcss

解决方案


尝试这个

body{
    max-width:1366px;
    background:#f1f1f1;
}

.gotop{
    position:absolute;
    right:25px;
    bottom:25px;
    cursor:pointer;
}
<body>
<button class='gotop'>TOP</button>
</body>


推荐阅读