how to put a button on top between two dives?(如何在两次潜水之间将按钮放在顶部?)
问题描述
我想用 css 做一个这样的设计,但我不知道如何把这个按钮放在两个 div
之间,谁能帮帮我?
I want to make a design like this using css, but i don't know how to put this button on top between two div
s, can anyone help me?
<div></div>
button
<div></div>
推荐答案
制作按钮样式position: absolute;
并定义right
和top
或 bottom
属性.
Make the button style position: absolute;
and define the right
and top
or bottom
properties.
如果您希望按钮在滚动时固定,请设置 position: fixed;
If you want the button to be fixed while scrolling, set position: fixed;
#up{
background-color:#B7005D;
height:10vh;
width:100%;
}
#middle{
background-color:#E0E1E0;
height:40vh;
width:100%;
}
#floating-button{
width: 50px;
height: 50px;
border-radius: 50%;
background: #B7005D;
position: fixed;
top: calc(50% - 25px);
right: 30px;
cursor: pointer;
box-shadow: 0px 2px 5px #666;
}
<div id="up"></div>
<div id="middle"></div>
<div id="floating-button"></div>
这篇关于如何在两次潜水之间将按钮放在顶部?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在两次潜水之间将按钮放在顶部?


基础教程推荐
- WatchKit 支持 html 吗?有没有像 UIWebview 这样的控制器? 2022-01-01
- 如何使用sencha Touch2在单页中显示列表和其他标签 2022-01-01
- 如何在特定日期之前获取消息? 2022-01-01
- Node.js 有没有好的索引/搜索引擎? 2022-01-01
- Javascript 在多个元素上单击事件侦听器并获取目标 2022-01-01
- 为什么我在 Vue.js 中得到 ERR_CONNECTION_TIMED_OUT? 2022-01-01
- 每次设置弹出窗口的焦点 2022-01-01
- jQuery File Upload - 如何识别所有文件何时上传 2022-01-01
- 如何使用 CSS 显示和隐藏 div? 2022-01-01
- 什么是不使用 jQuery 的经验技术原因? 2022-01-01