Quackit Logo

FREE Hosting!

With every domain name you register with ZappyHost, you get FREE hosting.

$1.99 Domain Names

With every new non-domain purchase thru ZappyHost, you get a domain name for only $1.99.

CSS Height and Width

Print Version

CSS includes height and width properties to help you specify the size of your elements.

'height' and 'width' Properties

Applies to all HTML elements except non-replaced inline elements, table columns and column groups.

Can use a fixed height (i.e. pixels) or a percentage height.

<div style="background-color:orange;height:125px;width:75px;">
This div has height and width applied.
</div>

This results in:

This div has height and width applied.

'max-height' and 'max-width' Properties

Enables you to constrain the height and/or width of an element to a maximum value.

<div style="background-color:orange;max-height:125px;max-width:75px;">
This div has max-height and max-width applied.
</div>

This results in:

This div has max-height and max-width applied.

'min-height' and 'min-width' Properties

Enables you to constrain the height and/or width of an element to a minimum value.

<div style="background-color:orange;min-height:125px;min-width:75px;">
This div has min-height and min-width applied.
</div>

This results in:

This div has min-height and min-width applied.

Enjoy this website?

  1. Link to this page (copy/paste into your own website or blog):
  2. Add this page to your favorite social bookmarks sites:
               
  3. Add this page to your Favorites

Oh, and thank you for supporting Quackit!