Skip to content

Instantly share code, notes, and snippets.

@hacke2

hacke2/center.css

Last active Aug 29, 2015
Embed
What would you like to do?
IE8以上css居中
.Center-Container {
position: relative;
}
.Absolute-Center {
width: 50%;
height: 50%;
overflow: auto;
margin: auto;
position: absolute;
top: 0; left: 0; bottom: 0; right: 0;
}
/*CSS3*/
.wrapper {
padding: 20px;
background:orange;
color:#fff;
position:absolute;
top:50%;
left:50%;
border-radius: 5px;
-webkit-transform:translate(-50%,-50%);
-moz-transform:translate(-50%,-50%);
transform:translate(-50%,-50%);
}
/*CSS3另一种方法*/
parent:before { content:'';display:inline-block;vertical-align:middle;height:100%}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.