height Attribute


 

Where to use the height Attribute


Description

The height attribute may be included on an img or an object element to specify the height of the element, either in pixels or as a percentage of the available vertical space (usually the parent element's height). This attribute will override the element's natural height and the image/object will be scaled to attain this specified height. If no width attribute is specified, the image/object's natural width will be scaled by the same factor, maintaining aspect ratio.

The advantage of specifying height and width attributes is that it informs the user agent in advance how big the final rendered element will be. The correct space on the screen can be allocated for it, avoiding the need to re-flow the page content once the image/object's actual dimensions have been determined.

See also the width attribute.


Page Footer & Copyright

Copyright © Sally Maughan 2005-2009 (Page last updated on 16 May 2009)

*Valid XHTML 1.1 - hosted by *Openstrike

Content based on the W3C Working Draft: *XHTML 1.1 and Recommendation: *XHTML Modularisation 1.1.

W3C, XHTML, XML, HTML, CSS and MathML are *Trademarks of the W3C (*MIT, *ERCIM, *Keio) with which the site's author has no connection.


Up, Next & Previous Links

Your Location

Home > XHTML 1.1 Home > XHTML 1.1 Indexes > Attribute Index (XHTML 1.1) > height Attribute (XHTML 1.1)