The CSS height and width property is used to set the height and width of the content area of an element.

Height property

It does not include padding borders or margins, whereas it sets the height of the area inside the padding, border, and margin of the element. It can accept the length and percentage values. But it does not allow negative values.
If the height of the container is not explicitly defined, and the element is not absolutely positioned (i.e., position: absolute;), the value of height property is set to auto. The min-height and max-height properties can also be used to control the size.

Syntax :  height : auto | length | initial | inherit;  
Property Values :
                    
    autoIt is a default value. Using this value browser is responsible for calculating the height of the element. Negative values are not allowed.
    lengthIt specifies the height of an element using the length units such as px, cm, pt, etc. Negative values are not allowed.
    %It defines the height of the container in %. Negative values are not allowed.
    initialIt is used to set the property to its default value.
    inheritIt is used to inherit the property from its parent element.

Width property
It does not include padding borders or margins. It sets width of the area inside the padding, border, and margin of the element.

Syntax : width : auto | length | initial | inherit;  
Property Values :
    
    autoIt is a default value. it is used to calculate the width.
            
    lengthIt is used to define the width in px, cm etc.
    %It defines the width of the containing block in %.
    initialIt is used to set the property to its default value.
    inheritIt is used to inherit the property from its parent element.

Example:


Output:

CSS Height And Width Example

The height and width of 150px.

The height and width of 100px.

Do you Know?
Progamming is what actually means ?

What is software development ?

How we categorized software development in different manner.

C Programming
C Plus Plus
Python
Java Development
Web Designing
Javascript
Mysql
Oracle
We cover all the programming concepts in various programming languages, this tutorials are very help full for bigener as well as Experience developer, for the ease of understanding we categorized programming in different manner likewise.