<style type="text/css">
* {
margin: 0;
padding: 0;
}
body {
text-align: center;
font-size: 14px;
color: gray;
}
.yellow {
background: goldenrod;
}
.blue {
background: skyblue;
}
.contain{
padding: 3px;
}
/* 使其居中 */
.contain{
position: absolute;
top:50%;
margin-top: -300px;
left:50%;
margin-left:-300px;
}
/* 使其内部居中 */
.contain {
display: flex;
flex-direction: column;
flex-wrap: wrap;
justify-content:space-around;
align-items: center;
align-content: space-around;
}
/* 设置大小 */
.contain {
width: 500px;
height: 500px;
}
.contain div {
border: 1px solid #808080;
}
.item{
display: flex;
align-items: center;
justify-content: center;
}
.item>span{
/* background: #808080; */
}
.item {
background: goldenrod;
width: 32%;
height: 32%;
}
</style>
</head>
<body>
<div id="contain" class="contain blue">
<div class="item "><span>1</span></div>
<div class="item "><span>2</span></div>
<div class="item "><span>3</span></div>
<div class="item "><span>4</span></div>
<div class="item "><span>5</span></div>
<div class="item "><span>6</span></div>
<div class="item "><span>7</span></div>
<div class="item "><span>8</span></div>
<div class="item "><span>9</span></div>
</div>
</body>
flex九宫格
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...