skip to Main Content

On Safari phones, I get a terrible white stripe on top. I would like it to be filled with background
My site

For example, on this site, there is no such strip on top
Example

HTML file:

<!DOCTYPE html>
<html lang="ru">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
    <title>Авторизация</title>
    <link rel="stylesheet" href="/css/login.css?v=1.1.4">
</head>
<body>
    <div class="container-border active">
    </div>
</body>
</html>

CSS file:

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    color: white;
}

html, body {
    height: 100vh;
    overflow-y: hidden;
    background: linear-gradient(180deg, hsl(250, 15%, 30%), hsl(250, 15%, 10%));
}

body {
    display: flex;
    align-items: center;
    justify-content: center;
}

2

Answers


  1. I suppose you mean changing the color of the status bar?

    Try to add apple-mobile-web-app-status-bar-style meta tag. You can checkout the ‘Changing the Status Bar Appearance’ of this page

    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    

    Or, you can try to add theme-color meta tag. theme-color

    Login or Signup to reply.
  2. I checked it on safari.

    images

    enter image description here

    Code

    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
      color: white;
    }
    
    html {
      padding-top: env(safe-area-inset-top);
      }
    
    html, body {
      height: 100vh;
      overflow-y: hidden;
      background: linear-gradient(180deg, hsl(250, 15%, 30%), hsl(250, 15%, 10%));
    }
    
    body {
      display: flex;
      align-items: center;
      justify-content: center;
    }
    <!DOCTYPE html>
    <html lang="ru">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
        <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
        <meta name="theme-color" content="hsl(250, 15%, 30%)"/>
        <title>Авторизация</title>
        <link rel="stylesheet" href="test.css">
    </head>
    <body>
        <div class="container-border active">
        </div>
    </body>
    </html>
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search