标签:
.center-children { text-align: center;}
.center-me { margin: 0 auto;}
.inline-block-center { text-align: center; } .inline-block-center div { display: inline-block; text-align: left; } .flex-center { display: flex; justify-content: center; }
.center-table { display: table; height: 250px; background: white; width: 240px; margin: 20px; } .center-table p { display: table-cell; margin: 0; background: black; color: white; padding: 20px; border: 10px solid white; vertical-align: middle; } .flex-center-vertically { display: flex; justify-content: center; flex-direction: column; height: 400px; } 块级元素? 知道元素高度? .parent { position: relative; } .child { position: absolute; top: 50%; height: 100px; margin-top: -50px; /* account for padding and border if not using box-sizing: border-box; */ }
.parent { position: relative; } .child { position: absolute; top: 50%; transform: translateY(-50%); }
.parent { display: flex; flex-direction: column; justify-content: center; }
原文地址:
标签:
原文地址:http://www.cnblogs.com/newromantics/p/5271117.html