Last active
September 22, 2016 06:51
-
-
Save libo1106/9777985 to your computer and use it in GitHub Desktop.
flex未知高度垂直居中写法
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="zh-CN" class="fullscreen"> | |
<head> | |
<title>flex未知高度垂直居中写法</title> | |
<style> | |
html,body{ | |
width: 100%; | |
height: 100%; | |
overflow: hidden; | |
} | |
.wrap{ | |
/* ie10 */ | |
display: -ms-flexbox; | |
-ms-flex-align:center; | |
/* android */ | |
display: -webkit-box; | |
-webkit-box-orient: horizontal; | |
-webkit-box-pack: center; | |
-webkit-box-align: center; | |
display: box; | |
box-orient: horizontal; | |
box-pack: center; | |
box-align: center; | |
/* chrome、 iOS */ | |
display: -webkit-flex; | |
display: flex; | |
-webkit-align-items: center; | |
align-items: center; | |
-webkit-justify-content: center; | |
justify-content: center; | |
width: 100%; | |
height: 100%; | |
} | |
.content{ | |
width: 100%; | |
background-color: #f90; | |
height: 100px; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="wrap"> | |
<div class="content"> | |
content | |
</div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment