CSS Dimensions

Using CSS, we can define dimensions (width and height) to an element. The following CSS properties are used to define dimensions of an element:

For example:

HTML with CSS Code
<!DOCTYPE html>
<html>
<head>
   <style>
      div{background-color: chocolate; color: white; padding: 10px;
         margin: 10px 0;}
      div.a{width: 220px; height: 100px;}
      div.b{min-width: 220px; min-height: 120px;}
   </style>
</head>
<body>
   
   <div class="a">fresherearth</div>
   <div class="b">fresherearth</div>
   
</body>
</html>
Output
fresherearth
fresherearth

CSS Online Test


« Previous Tutorial Next Tutorial »