
利用值为 center 的 justify-content 属性将弹性名目对于全到焦点。
事例
你否以测验考试运转下列代码来完成核心值
现场演示
<!DOCTYPE html>
<html>
<head>
<style>
.mycontainer {
display: flex;
background-color: red;
justify-content: center;
}
.mycontainer > div {
background-color: #F1C40F;
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>Q两</div>
<div>Q3</div>
<div>Q4</div>
</div>
</body>
</html>登录后复造
以上便是利用CSS将flex名目对于全到容器的焦点的具体形式,更多请存眷萤水红IT仄台其余相闭文章!

发表评论 取消回复