Skip to content

Instantly share code, notes, and snippets.

@movii
Created June 24, 2017 05:58
Show Gist options
  • Save movii/78c04750acf46c11b9b3f4914dc1c1c0 to your computer and use it in GitHub Desktop.
Save movii/78c04750acf46c11b9b3f4914dc1c1c0 to your computer and use it in GitHub Desktop.
笔记:前端开发中的「居中」,绝对定位,transform 和 flex 布局:4. 相对绝对定位
/* center by traditional relative/absolute position */
/* parent */
.box.box_centerByAbsolute {
position: relative;
}
/* child */
.box.box_centerByAbsolute .content {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
margin: auto;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment