Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS10 position + flex #25

Open
OPY-bbt opened this issue Dec 2, 2019 · 0 comments
Open

iOS10 position + flex #25

OPY-bbt opened this issue Dec 2, 2019 · 0 comments
Labels

Comments

@OPY-bbt
Copy link
Owner

OPY-bbt commented Dec 2, 2019

绝对定位或者固定定位时,一定要设置两个方向的值(top,left)

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        html, body {
            margin: 0;
            padding: 0;
        }
        .outer {
            position: fixed;
            top: 0;
            bottom: 0;
            left: 0;
            right: 0;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .inner {
            width: 90%;
            height: 30%;
            top: 15%;
            left: 5%; // 如果不设置left, iOS10.3中会不居中(inner div的左侧在中央)
            position: absolute;
            background-color: red;
        }
    </style>
</head>
<body>
    <div class="outer">
        <div class="inner"></div>
    </div>
</body>
</html>
@OPY-bbt OPY-bbt added the css label Dec 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant