This website may use cookies. More info. That's Fine x
Welcome Login

Css: height and width


height property:

height property sets the height of an element.

 

width property:

width property sets the width of an element.

 

 

Example:

Eg: total height is 120px when you add the padding heights too (top and bottom)

<html>

<head>

<style type="text/css">
.dimension {
  width:300px;
  height:100px;
  padding: 10px; 
  
  background-color:grey;
}
</style>


</head>

<body>

<div class="dimension">
     Box test
</div>

</body>

</html>

 

Outputs:

css-dimension1


Created on: Thursday, October 25, 2012 by Andrew Sin