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>
这篇关于如何在两次潜水之间将按钮放在顶部?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在两次潜水之间将按钮放在顶部?


基础教程推荐
- Bokeh Div文本对齐 2022-01-01
- 即使用户允许,Gmail 也会隐藏外部电子邮件图片 2022-01-01
- 检查 HTML5 拖放文件类型 2022-01-01
- Fabric JS绘制具有活动形状的多边形 2022-01-01
- 在 contenteditable 中精确拖放 2022-01-01
- 如何添加到目前为止的天数? 2022-01-01
- 原生拖动事件后如何获取 mouseup 事件? 2022-01-01
- Bootstrap 模态出现在背景下 2022-01-01
- npm start 错误与 create-react-app 2022-01-01
- fetch 是否支持原生多文件上传? 2022-01-01