×

Html & Html5

The World's best Software Development Study Portal

CSS height and width



Using height and width property we can set the height and width of any element here in CSS. And we can set the values to auto (browser will calculate automatically) and the length values (px,cm, %)

Let's understand this by the following program:-


<!DOCTYPE html>

<html>

<head>

<style>

div{

width:500px;

height:200px;

background-color:pink;

}

</style>

</head>

<body>

<div>

<p> I am Manish </p>

<p class="red"> Hey I love India </p>

</div>

</body>

</html>



Output of the Program



I am Manish

Hey I love India




Let's talk more about height-width properties



Property Description
height sets height of an element
max-height sets maximum height of an element
max-width Sets the maximum width of an element
min-height Sets the minimum height of an element
min-width Sets the minimum width of an element
width Sets the width of an element







CSS 3 training insitute | Best IT Training classes in Gurgaon | Web Designing Training Institute