html - 在两个 div 的中间和中间添加按钮
解决方案
使用负边距。假设按钮的高度为 30px:将 -15px 的边距顶部和 -15px 的边距底部应用到按钮容器(例如,如果你想要它在中间)
body,html{margin: 0; padding: 0;}
.div1 {
background: tomato;
height: 100px;
}
.div2 {
background: grey;
height: 100px;
}
.buttons{
margin-top: -15px;
margin-bottom: -15px;
text-align: center;
}
button {
height: 30px;
}
<div class="div1"></div>
<div class="buttons">
<button>button 1</button>
<button>button 2</button>
</div>
<div class="div2"></div>
推荐阅读
- python-3.x - Extract a table out of data frame in pandas based on a condition
- powershell - -f 空白空间的未知原因
- talend - How to fix update problem in Talend Studio?
- bash - Setting up gnome-keybindings in a Bash function
- linux - 如何修复 SBT 崩溃:java.lang.NumberFormatException:对于输入字符串:“0x100”?
- c# - ObservableCollection
and updating the UI when the item changes - sql - How can i get all the minimum values of 1st column, then get all the minimum values of 2nd column of each minimum values of 1st column?
- typescript - 如何将反应钩子返回到组件中
- c++11 - automatic Structure deserialization/conversion with c++ templates
- r - How to manipulate tables / dataframe from input in shiny?