Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> CSS

CSS Grid Rows

แนวนอนใน CSS Grid เรียกว่า Grid Rows สามารถกำหนดขนาดและจำนวนแถวได้ด้วยคุณสมบัติ grid-template-rows

การใช้งาน

.container {
  display: grid;
  grid-template-rows: 100px 200px auto; /* 3 แถว: คงที่ 100px, 200px, และส่วนที่เหลือ */
  /* หรือใช้ repeat() */
  grid-template-rows: repeat(3, 1fr); /* 3 แถวเท่ากัน */
}

Grid Rows ทำงานร่วมกับ Grid Columns เพื่อสร้างโครงสร้าง 2 มิติที่ยืดหยุ่นได้