Grid-Area & Grid-Template-Areas

grid-area គឺ​ជា property ដែល​ត្រូវ​គេ​យក​ទៅ​ប្រើប្រាស់ ក្នុង​ការកំណត់​ឈ្មោះ​អោយ​ផ្នែក​ផ្សេង​ៗ​នៃ​ផ្ទៃ​របស់ element ណាមួយ ដែល​ផ្ទៃ​របស់​វា​ទាំងមូល ត្រូវ​បាន​កំណត់​ជា​ក្រឡាចត្រង្គ ឬ ក្រឡា​សំណាញ់ (grid) ។ ចំណែក​ឯ grid-template-areas វីញ វា​ជា property ដែល​ត្រូវ​គេ​យក​ទៅ​ប្រើប្រាស់​សំរាប់​កំណត់​ចំនួន column សំរាប់​លាត​សន្ទឹង​ផ្នែក​នៃ​ក្រឡា​ចត្រង្គ​ណា​មួយ​ដែល​ត្រូវ​បាន​ដាក់​ឈ្មោះ​ថា​អ្វី​មួយ​។

<!DOCTYPE html>
<html>
  <head>
  	<meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  	<title>Grid-Area Property</title>
    <style>
      .item1 {
  		grid-area: myArea;
	  }

	  .grid-container {
  		display: grid;
  		grid-template-areas: 'myArea myArea myArea myArea myArea';
  		grid-gap: 10px;
  		background-color: #2196F3;
  		padding: 10px;
	  }

	  .grid-container > div {
  		background-color: rgba(255, 255, 255, 0.8);
  		text-align: center;
  		padding: 20px 0;
  		font-size: 30px;
	  }
    </style>
  </head>
  
  <body>
	

The grid-area Property

You can use the grid-area property to name grid items.

You can refer to the name when you set up the grid layout, by using the grid-template-areas property on the grid container.

Item1, is called "myArea" and will take up the place of all five columns:

1
2
3
4
5
6
</body> </html>

The grid-area Property

You can use the grid-area property to name grid items.

You can refer to the name when you set up the grid layout, by using the grid-template-areas property on the grid container.

Item1, is called "myArea" and will take up the place of all five columns:

1
2
3
4
5
6