Set element height

Description

The following code shows how to set element height.

Example


<html>
<head>
<script
  src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
  $(document).ready(function() {<!--from ww  w.  j  a  va 2 s. co  m-->
    $("div").height(300);
  });
</script>
<style>
div {
  width: 200px;
  height: 100px;
  overflow: auto;
  background-color: red;
}

h1 {
  width: 1000px;
  height: 1000px;
}
</style>

</head>
<body>
<body>
  <div>
    <h1>java2s.com</h1>
  </div>
</body>
</html>

Click to view the demo





















Home »
  jQuery »
    jQuery Example »




Animation
DOM
Event
Form
List
Select
Style
Table
Utilities