我正在为仅移动版本的网站创建“类似于应用程序”的菜单栏。该栏的中心有两个可单击的图标和一个主按钮。即使我设法编写了html / css,也无法单击图标,因为“ +”按钮位于图标上方。有没有一种方法可以使我进行安排,使用户能够单击菜单以及加号和用户的图标?
这是我的设计:
我设法通过以下代码创建了这个设计(我正在使用Bootstrap 4和Fontawesome)
.footer-container-mobile {
position: fixed;
bottom: 0;
left: 0;
right: 0;
z-index: 10;
height: 54px;
background-color: #8ABE57;
width: 100%;
margin: 0 auto;
padding: 10px 40px;
box-shadow: 0px -4px 8px rgba(0, 0, 0, 0.1);
}
.footer-container-mobile i {
color: white;
font-size: 1.3em;
margin-top: 5px;
}
.circle-btn-mobile {
width: 70px;
height: 70px;
border-radius: 50%;
background-color: #31353C;
color: white;
text-align: center;
align-items: center;
font-size: 2em;
filter: drop-shadow(0px 0px 13px rgba(0, 0, 0, 0.47));
display: flex;
flex-direction: row;
}
.circle-btn-mobile-container {
z-index: 50;
position: fixed;
bottom: 12px;
left: 0;
right: 0;
}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">
<div class="container-fluid">
<div class="row d-flex footer-container-mobile">
<a href="#" class="mr-auto"><i class="far fa-bars"></i>Icon</a>
<a href="#" class="ml-auto"><i class="fas fa-user-plus">Icon</i></a>
</div>
<div class="row circle-btn-mobile-container">
<div class="d-flex justify-content-center mx-auto circle-btn-mobile">
<i class="far fa-plus">+</i>
</div>
</div>
</div>
width: fit-content;
为circle-btn-mobile-container
容器添加css ,并按m-auto
如下所示进行类制作margin: auto;
:
<div class="row circle-btn-mobile-container m-auto">
.footer-container-mobile {
position: fixed;
bottom: 0;
left: 0;
right: 0;
z-index: 10;
height: 54px;
background-color: #8ABE57;
width: 100%;
margin: 0 auto;
padding: 10px 40px;
box-shadow: 0px -4px 8px rgba(0, 0, 0, 0.1);
}
.footer-container-mobile i {
color: white;
font-size: 1.3em;
margin-top: 5px;
}
.circle-btn-mobile {
width: 70px;
height: 70px;
border-radius: 50%;
background-color: #31353C;
color: white;
text-align: center;
align-items: center;
font-size: 2em;
filter: drop-shadow(0px 0px 13px rgba(0, 0, 0, 0.47));
display: flex;
flex-direction: row;
}
.circle-btn-mobile-container {
width: fit-content;
z-index: 50;
position: fixed;
bottom: 12px;
left: 0;
right: 0;
}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">
<div class="container-fluid">
<div class="row d-flex footer-container-mobile">
<a href="#" class="mr-auto"><i class="far fa-bars"></i>Icon</a>
<a href="#" class="ml-auto"><i class="fas fa-user-plus">Icon</i></a>
</div>
<div class="row circle-btn-mobile-container m-auto">
<div class="d-flex justify-content-center mx-auto circle-btn-mobile">
<i class="far fa-plus">+</i>
</div>
</div>
</div>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句