justify-content প্রোপার্টি ফ্লেক্স আইটেমগুলোর মেইন-অক্ষ (ডিফল্টভাবে হরিজেন্টাল) দিয়ে বিন্যাস নির্ধারণ করে।
উদাহরণ
নিচের কোডটি চালিয়ে justify-content প্রোপার্টির ব্যবহার দেখুন:
<!DOCTYPE html> <html>
<head>
<style>
.mycontainer {
display: flex;
background-color: orange;
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>
ব্যাখ্যা: justify-content: center সেট করলে সব ফ্লেক্স আইটেম কন্টেইনারের হরিজেন্টাল মাঝপথে গ্রুপ হয়ে যাবে। অন্যান্য মান: flex-start, flex-end, space-between, space-around, space-evenly।