当弹性物件未使用主轴上的所有可用空间时,将弹性物件水平对齐
当项目未使用主轴上所有可用空间时,请使用 justify-content属性将弹性项目水平对齐。
您可以尝试运行以下代码以实现justify-content属性
示例
<!DOCTYPE html>
<html>
<head>
<style>
.mycontainer {
display: flex;
background-color: blue;
justify-content: center;
}
.mycontainer > div {
background-color: white;
text-align: center;
line-height: 40px;
font-size: 25px;
width: 100px;
margin: 5px;
}
</style>
</head>
<body>
<h1>Quiz</h1>
<div class = "mycontainer">
<div>Q1</div>
<div>Q2</div>
<div>Q3</div>
<div>Q4</div>
</div>
</body>
</html>热门推荐
10 开业祝福语简短大气的
11 恭喜新郎父母简短祝福语
12 送给情侣贺卡祝福语简短
13 父亲简短结婚祝福语大全
14 老考试顺利祝福语简短
15 对上司的简短祝福语
16 上海返乡祝福语简短精辟
17 中秋祝福语简短版大全
18 送给同桌的祝福语简短