minHeight Property - Javascript CSS Style Property

Javascript examples for CSS Style Property:minHeight

Description

The minHeight property sets or gets the minimum height of an element.

Property Values

Value Description
length minimum height in length units. Default is 0
% minimum height in percentage of the parent element
initial Sets this property to its default value.
inherit Inherits this property from its parent element.

Technical Details

Item Value
Default Value: 0
Return Value: A String, representing the minimum height of an element
CSS VersionCSS2

Set the minimum height of a <div> element:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<div style="background:red;min-height:150px;" id="myDiv">This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text.</div><br>

<button type="button" onclick="myFunction()">test</button>

<script>
function myFunction() {//w w  w . ja  v a  2  s  .  c o  m
    document.getElementById("myDiv").style.minHeight = '110px';
}
</script>

</body>
</html>

Related Tutorials