Tryit Editor v1.8

Source Code:
<!DOCTYPE html> <html> <head> <script> function displayResult() { document.getElementById("p1").style.maxHeight="15px"; } </script> </head> <body> <p style="background:red;" id="p1">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.</p> <input type="button" onclick="displayResult()" value="Set max height"> </body> </html>
Result:
W3Schools.com - Try it yourself