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

使用flex布局实现垂直水平居中效果 #46

Open
zhuguly-zz opened this issue Jul 2, 2020 · 0 comments
Open

使用flex布局实现垂直水平居中效果 #46

zhuguly-zz opened this issue Jul 2, 2020 · 0 comments

Comments

@zhuguly-zz
Copy link
Owner

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>flex 垂直水平居中</title>
  <style>
    div {
      max-width: 500px;
      height: 300px;
      border: 1px solid;
      margin: 10px;
      display: flex;
    }

    span {
      background: pink;
    }

    .no-auto {
      justify-content: center;
      align-items: center;
    }

    .auto > span {
      margin: auto;
    }
  </style>
</head>
<body>
  <div class="no-auto">
    <span>不用auto的</span>
  </div>
  <div class="auto">
    <span>用auto的</span>
  </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