在CSS中的行之间显示带空格的flex项目
使用justify-content属性,并在其间设置空格,以在行之间添加空格。
示例
您可以尝试运行以下代码以实现间隔值-
<!DOCTYPE html>
<html>
<head>
<style>
.mycontainer {
display: flex;
background-color: red;
justify-content: space-between;
}
.mycontainer > div {
background-color: white;
text-align: center;
line-height: 60px;
font-size: 30px;
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>