Set the height of a <button> element:
The height property sets or returns the height of an element.
The height property has effect only on block-level elements or on elements with absolute or fixed position. The overflowing content can be manipulated with the overflow property.
Tip: Use the width property to set or return the width of an element.
The height property is supported in all major browsers.
Return the height property:
Set the height property:
Value | Description |
---|---|
auto | The browser sets the height. This is default |
length | Defines the height in length units |
% | Defines the height in % of the parent element |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Default Value: | auto |
---|---|
Return Value: | A String, representing the height of an element |
CSS Version | CSS1 |
Change the height of a <div> element:
Change the height and width of an <img> element:
Return the height of an <img> element:
CSS tutorial: CSS Dimension
CSS tutorial: CSS Box model
CSS reference: height property