CSS Width

  • Purpose: Sets the height of an element.
  • Syntax: element { height: value; }
    • element: The HTML element you want to style.
    • value: The height of the element (e.g., 100px, 50%, auto).
  • Example:
div {
height: 200px;
}

This will set the height of all <div> elements to 200 pixels.

CSS Height

  • Purpose: Sets the width of an element.  
  • Syntax: element { width: value; }
    • element: The HTML element you want to style.
    • value: The width of the element (e.g., 300px, 75%, auto).
  • Example:
img {
width: 50%;
}

This will set the width of all <img> elements to 50% of their parent container’s width.

Scroll to Top