CSS Height, Width and Max-width



The CSS height and width properties are used to set the height and width of an element.

The CSS max-width property is used to set the maximum width of an element.

Example


      <!DOCTYPE html>
      <html>
      <head> 
      <style> 

      div  {
        height:50px;
        width:100%;
        border:1px solid #4CAF50;
        
            }

      </style> 
      </head> 
      <body> 


      <h2>CSS height and width properties</h2>
      <div> (AIT) Academy of Information Technology</div>

     
  
          </body>
          </html>
                
              
Result:
Example Image

CSS Setting height and width

The height and width properties are used to set the height and width of an element.

The height and width properties do not include padding, borders, or margins. It sets the height/width of the area inside the padding, border, and margin of the element.

Example


      <!DOCTYPE html>
      <html>
      <head> 
      <style> 

      div  {
        height:200px;
        width:50%;
        background-color:yellow;
        
            }

      </style> 
      </head> 
      <body> 


      <h2>Set the height and width of an element</h2>
      <div> (AIT) Academy of Information Technology</div>

     
  
          </body>
          </html>
                
              
Result:
Example Image