The height property is used to set the height of an element. The height property does not contains padding, margin and border of element. The height property contains many values which define the height of an element. The height property values are listed below:
- height: auto; It is used to set height property to its default value. If the height property set to auto then the browser calculates the height of element.
- height: length; It is used to set the height of element in form of px, cm etc. The length can not be negative.
- height: initial; It is used to set height property to its default value.
- height: inherit; It is used to set height property from its parent element.
Example 1: This example use height: auto; property to display the content.
Example 2: Thie example use height: inherit property to display the content.
- How to make div width expand with its content using CSS ?
- How to copy the content of a div into another div using jQuery ?
- How to clear all div's content inside a parent div ?
- How to dynamically get the content height of a div using AngularJS ?
- How to overlay one div over another div using CSS
- How to make div not larger than its contents using CSS?
- How to give a div tag 100% height of the browser window using CSS
- How to place two div side-by-side of the same height using CSS?
- How to align content of a div to the bottom using CSS ?
- How to set div width to fit content using CSS ?
- How to position a div at the bottom of its container using CSS?
- How to center a div within another div?
- HTML width/height Attribute vs CSS width/height Property
- How to make an image center-aligned (vertically & horizontally) inside a bigger div using CSS?
- How to make a div fill a remaining horizontal space using CSS?
- Make a div horizontally scrollable using CSS
- How to make a HTML div responsive using CSS ?
- How to make a div span two rows in a grid using CSS ?
- How to animate div width and height on mouse hover using jQuery ?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : shubham_singh