html - 保持按钮固定,但在体内
问题描述
body{
max-width:1366px;
}
.gotop{
position:fixed;
right:9px;
bottom:7px;
cursor:pointer;
width:25px;
}
gotop
是一个在顶部滚动页面的按钮,它不能是可滚动的,即必须是fixed
.
问题出在大于 1366 像素的显示器上。按钮离身体很远。
如何保持固定,但在体内?
解决方案
尝试这个
body{
max-width:1366px;
background:#f1f1f1;
}
.gotop{
position:absolute;
right:25px;
bottom:25px;
cursor:pointer;
}
<body>
<button class='gotop'>TOP</button>
</body>
推荐阅读
- javascript - 使用 javascript 在条件上添加 var
- spring-boot - 如果身份验证/授权失败,如何自定义 Spring Security 响应?
- scala - 如何使用 RDD、数据框、数据集计算数组中重复的值
- laravel - Laravel - 日期范围搜索过滤器不起作用
- vue.js - 如何更改 Vuestic Admin 主题图标
- windows - 使用 Chef 之类的工具进行开发 PC 设置
- java - 使用 Jersey 到 API 的 POST 请求出错,与 POSTMAN 一起工作正常
- windows - 无法使用 USB 上的批处理文件在桌面上创建空白 .txt 文件
- ios - UserDefaults 数组返回为空
- c++ - “#pragma optimize”应该在标题、.cpp 中还是两者兼有?