Quackit Logo
HTML
CSS
Scripting
Database
Hosting
Design
XML

Print Version

CSS Height and Width

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?

  • Share
  • Add this page to your Favorites
  • Link to this page (copy/paste into your own website or blog):
  • Link to Quackit using one of these banner ads.
  • Help support Quackit by making a donation

Oh, and thank you for supporting Quackit!

© Copyright 2000 - 2010 Quackit.com