Skip to content

5.CSS 实现垂直水平居中 #5

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

Open
webVueBlog opened this issue Mar 10, 2020 · 0 comments
Open

5.CSS 实现垂直水平居中 #5

webVueBlog opened this issue Mar 10, 2020 · 0 comments
Labels
css css

Comments

@webVueBlog
Copy link
Member

HTML 结构:

<div class="wrapper">
<div class="content"></div>
</div>

CSS结构:

.wrapper {
position: relative;
width: 500px;
height: 500px;
border: 1px solid red;
}
.content{
position: absolute;
width: 200px;
height: 200px;
/*top、bottom、left 和 right 均设置为 0*/
top: 0;
bottom: 0;
left: 0;
right: 0;
/*margin 设置为 auto*/
margin:auto;
border: 1px solid green;
}
@webVueBlog webVueBlog added the css css label Mar 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css css
Projects
None yet
Development

No branches or pull requests

1 participant