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

CSS: 垂直居中 #66

Open
leslie1943 opened this issue Nov 24, 2020 · 0 comments
Open

CSS: 垂直居中 #66

leslie1943 opened this issue Nov 24, 2020 · 0 comments

Comments

@leslie1943
Copy link
Owner

垂直居中

.container {
            margin: 0 auto;
            width: calc(100vw - 220px);
            height: calc(100vh - 300px);
            background: rgb(69, 70, 65);
            display: flex;
            /* justify-content:(x轴对齐) flex-start:从左开始 flex-end:从右开始 center:居中开始 */
            /* align-items     (y轴对齐) flex-start: 从上排序 flex-end: 从下排序 center:居中开始 */
            justify-content: center;
            align-items: center;
        }

demo

<!DOCTYPE html>
<html lang="en">

<head>
    <title>Flex layout</title>
    <style>
        .container {
            margin: 0 auto;
            width: calc(100vw - 220px);
            height: calc(100vh - 300px);
            background: rgb(69, 70, 65);
            display: flex;
            /* justify-content:(x轴对齐) flex-start:从左开始 flex-end:从右开始 center:居中开始 */
            /* align-items     (y轴对齐) flex-start: 从上排序 flex-end: 从下排序 center:居中开始 */
            justify-content: center;
            align-items: center;
        }
    </style>
</head>

<body>
    <div class="container">
        <div>
            <div class="hello world">Hello World 🚀🚀</div>
            <div class="hello vue">Hello Vue 🏳‍🌈🏳‍🌈</div>
            <div class="hello green">Hello Vuex 🌈🌈</div>
        </div>
    </div>


</body>

</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant