javascript maxHeight property


  Translation results:

max

UK[mæks] 美[mæks]

adv.At most

height

英[haɪt] 美[haɪt]

n.Height; height, altitude; highland; top, vertex

Plural: heights

javascript maxHeight propertysyntax

Function:Set the maximum height of the element.

Syntax: Object.style.maxHeight=length|%

javascript maxHeight propertyexample

<html>
<head>
	<meta charset="UTF-8">
<script type="text/javascript">
function setMaxHeight()
{
document.getElementById("p1").style.maxHeight="10px";
}
</script>
</head>
<body>

<p id="p1">这是一些文本内容,这是一些文本内容,这是一些文本内容,这是一些文本内容</p>

<input type="button" onclick="setMaxHeight()"
value="Set max height" />

</body>
</html>

Run instance »

Click the "Run instance" button to view the online instance

Home

Videos

Q&A