iOS上状态栏后面显示白色背景的网站

huangapple go评论75阅读模式
英文:

Site showing white background behind status bar on iOS

问题

我在iOS设备上的网站上遇到了状态栏颜色的问题。背景颜色似乎被忽略了,在我的iOS设备上状态栏后面有一个白色的条。我尝试过使用HSL颜色标签设置theme-color和apple-mobile-web-app-status-bar-style的meta标签,但它们似乎没有起作用。当我最小化页面,然后打开另一个选项卡并返回时,有时状态栏后面的背景变成了正确的颜色,并且像我希望的那样工作。

有人有任何想法如何解决这个问题吗?
不良示例
良好示例

网站上的代码。

英文:

Im having trouble with the status bar color on my website for iOS device. The background color seems to be ignored and there is a white bar behind the status bar on my ios device. I’ve tried setting up theme-color and apple-mobile-web-app-status-bar-style meta tags with HSL color tags but they don’t seem to do anything. When I minimize the page and open another tab and come back to it, sometimes the background behind the status bar becomes the correct color and works like I would like it to.

Does anyone have any ideas for how I can fix this?
bad example
good example

Code on website.

答案1

得分: 0

通过将background-color属性添加到html元素来解决。当样式仅应用于body时,状态栏后面和导航栏下面的区域会变为白色且可拖动。

英文:

Solved by adding the background-color property to the html element.
when the style was only applied to the body the area behind the status bar and under the navigation bar would be white and draggable

huangapple
  • 本文由 发表于 2023年6月26日 09:27:58
  • 转载请务必保留本文链接:https://go.coder-hub.com/76553045.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定