Media Query

នៅ​ក្នុង​ការរចនា​គេហទំព័រ @media គឺ​ជា rule មួយ​ដែល​ត្រូវ​បាន​គេ​យក​ទៅ​ប្រើប្រាស់​ក្នុង​ការរចនា​ក្បាច់​ខុស​ៗ​គ្នា​តំរូវ​ទៅ​តាម​ទំហំ​ screen របស់​ឧបករណ៍​អេឡិចត្រូនិក មាន​ដូចជា screen របស់ desktop, laptop, iPad, និង ទូរស័ព្ទ​ដៃ​ជា​ដើម​។ ហើយ​ការ​កែច្នៃ​គេហទំព័រ​អោយ​មាន​ក្បាច់​រចនា​ខុស​ៗ​គ្នា​អាស្រ័យ​ទៅ​តាម​ឧបករណ៍​អេឡិចត្រូនិក​នេះ ត្រូវ​គេ​ហៅ​ជា​ភាសា​អង់គ្លេស​ថា responsive design

<!DOCTYPE html>
<html>
  <head>
  	<meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  	<title>Media Query</title>
    <style>
      body {
  		background-color: pink;
	  }

	  @media screen and (min-width: 600px) {
  	  	body {
    	  background-color: lightgreen;
  	  	}
	  }
    </style>
  </head>
  
  <body>
	

Resize the browser window to see the effect!

The media query will only apply if the media type is screen and the viewport is 600px wide or wider.

</body> </html>

Resize the browser window to see the effect!

The media query will only apply if the media type is screen and the viewport is 600px wide or wider.