กำหนดคอนเทนเนอร์แบบยืดหยุ่นและตั้งค่ารายการแบบยืดหยุ่นในนั้น
คุณสามารถลองเรียกใช้โค้ดต่อไปนี้เพื่อเรียนรู้วิธีใช้องค์ประกอบ Flexbox Q1, Q2, Q3 นี่คือรายการแบบยืดหยุ่น พื้นที่ทั้งหมดเป็นองค์ประกอบ Flexbox
ตัวอย่าง
<!DOCTYPE html> <html> <head> <style> .mycontainer { display: flex; background-color: orange; } .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>Q5</div> <div>Q6</div> </div> </body> </html>