jQuery Style How to - Set div height by editing the css








Question

We would like to know how to set div height by editing the css.

Answer


<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery.js'></script>
<script type='text/javascript'>
$(window).load(function(){<!--from w  w  w. j a va2s .c  om-->
    $('#banner_space').css({
        height : '200px',
        width : '300px',
        border : '10px solid #EEE'
    });
    $('#banner_space').css('background-color','red');
});
</script>
</head>
<body>
  <div id="banner_space"></div>
</body>
</html>

The code above is rendered as follows: