css - 当 URL 栏在滚动时调整大小时,灰色栏与 Chrome Mobile 上的 UI 重叠?
问题描述
我正在我的网站的移动版本上实现一个类似应用程序的底部导航栏。我遇到了滚动时灰色条与底部导航栏重叠的问题。我认为这是由于 URL 栏滚动出视图时窗口调整大小所致。 打嗝的时候是这样的。
关于如何将底部导航固定在窗口底部的任何想法,即使由于 URL 栏隐藏而正在调整大小?
这是底部导航元素和页脚中每个链接的 CSS:
.footer {
-webkit-box-align: center;
align-items: center;
border-top-style: solid;
border-top-width: 1px;
border-top-color: darkgrey;
background-color: white;
bottom: 0;
display: flex;
justify-content: space-around;
left: 0;
position: fixed;
right: 0;
z-index: 2000;
}
.footerLink {
-webkit-box-align: center;
align-items: center;
color: darkgrey;
display: flex;
flex-direction: column;
flex-shrink: 1;
font-size: .9rem;
line-height: 1;
-webkit-box-pack: center;
justify-content: center;
position: relative;
text-align: center;
width: 4rem;
height: 4.0rem;
border-radius: 2px;
text-decoration: none;
}
这是 React 元素的 Javascript:
const BottomNav = (props) => {
return (
<div className={headerStyles.footer} >
<Link className={styleFooter('/')}
to='/'
>
<Icon size='large' style={{ margin: '3px' }} name='home' />Home</Link>
<Link
className={styleFooter('/exclusive-dining')}
to='/exclusive-dining'
>
<Icon size='large' name='food' />Packages</Link>
<Link
className={styleFooter('/happy-hour-finder')}
to='/happy-hour-finder'
>
<Icon size='large' name='glass martini' />
Happy Hours</Link>
<Link
className={styleFooter('/articles')}
to='/articles'
>
<Icon size='large' name='newspaper' />Articles</Link>
<Link
className={styleFooter('/app/profile')}
to='/app/profile'
>
<Icon size='large' name='user' />Profile</Link>
</div >
)
}
export default BottomNav;
解决方案
好的,我想通了。在我的全局 CSS 中,我意识到在 html 标记上将溢出设置为隐藏,如下所示:
html {
box-sizing: border-box;
overflow: hidden;
}
这导致额外的屏幕空间在调整内部窗口大小时显示为空白。删除此代码解决了该问题。
推荐阅读
- java - 使用模型映射器的外键映射
- radio-button - 在android中以编程方式创建Radiogroup
- spring-integration - Spring Integration - 消息偶尔没有得到处理并且将进入空通道
- kubernetes - 尝试在 Kubernetes 中创建秘密时遇到一些问题
- visual-studio-code - 在 Visual Studio Code 上,如何指定我的 pytest.ini 文件以进行测试发现
- reactjs - 当用户可以输入用户名或电子邮件时,如何更新正确的字段?
- c# - 段落元素上的新行
不起作用 - regex - 有条件地提取正则表达式模式的开头
- php - 如何使用mysql查询的结果作为另一个查询的列名
- ionic-framework - Ionic 3 AlertController:单词在新行上分成 2 个单词