Home | Computer Science

<
CSS Height, Width

Defination

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


CSS Height Width Syntax of height width is
h1 {
height\width: ;
}
The height and width properties may have the following values:
  • % - Defines the height/width in percent of the containing block
  • initial - Sets the height/width to its default value
  • inherit - The height/width will be inherited from its parent value Program
    INPUT

    <html> <head> <style> div { height: 100px; width: 500px; background-color: powderblue; } </style> >/head> <body> <div>This div element has a height of 100px and a width of 500px.</div> </body> </html>

    OUTPUT