Width & Height

width & height ត្រូវ​បាន​គេ​យក​ទៅ​ប្រើប្រាស់​សំរាប់​កំណត់​ទទឹង​និង​កំពង់​របស់ element ទាំងឡាយ​។

<!DOCTYPE html>
<html>
  <head>
  	<meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  	<title>Width & Height</title>
    <style>
      div {
  		height: 200px;
  		width: 50%;
  		background-color: powderblue;
	  }
    </style>
  </head>
  
  <body>
	

Set the height and width of an element

This div element has a height of 200px and a width of 50%:

</body> </html>

Set the height and width of an element

This div element has a height of 200px and a width of 50%:


max-width property ត្រូវ​បាន​គេប្រើប្រាស់​សំរាប់​កំណត់​ទទឹង​ជា​អតិបរិមា​របស់​ element ទាំងឡាយ​។

<!DOCTYPE html>
<html>
  <head>
  	<meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  	<title>Width & Height</title>
    <style>
      div {
  		max-width: 500px;
  		height: 100px;
  		background-color: powderblue;
	  }
    </style>
  </head>
  
  <body>
	

Set the max-width of an element

This div element has a height of 100px and a max-width of 500px:

Resize the browser window to see the effect.

</body> </html>

Set the max-width of an element

This div element has a height of 100px and a max-width of 500px:

Resize the browser window to see the effect.