/*样式*/
html, body {
width: 100%; height: 100%;
background-color: #D8D8D8;
justify-content: center;/*水平居中*/
align-items: center; /*垂直居中*/
display: -webkit-flex;
display: -moz-flex;
display: flex;
}
@media screen and (min-width: 1260px) {
#main_content { width: 1200px; height: 572px; }
}
@media screen and (max-width: 1259px) {
#main_content { width: 88%; height: 572px; }
}
/*重写滚动条*/
::-webkit-scrollbar { width: 5px; height: 12px; -webkit-border-radius: 40%; }
::-webkit-scrollbar-thumb { background: #c3c3c3; -webkit-border-radius: 12px; }
<body>
<div id="main_content"></div>
</body>
css让div水平垂直居中,用弹性盒子
最新推荐文章于 2024-08-16 15:26:29 发布