width
This property specifies the content width of the elements.
HTML snippet
<div>
Hello world! Welcome to this tutorial page!
</div>
CSS snippet
div{
background-color: #e1e1e1; /*light gray color*/
width : 200px;
}
Output:
The width of the <div> element is reduced to 200px;
*Try removing the width property and test the difference.
height
This property specifies the content height of the elements.
HTML snippet
<div>
Hello world! Welcome to this tutorial page!
</div>
CSS snippet
div{
background-color: #e1e1e1; /*light gray color*/
width : 200px;
height : 200px;
}
Output:
The height of the <div> element is changed to 200px;
*Try removing the width property and test the difference.