asp.net.ph

HtmlImage.Height Property

System.Web.UI.HtmlControls Namespace   HtmlImage Class


Sets or retrieves the height of the image.

Syntax


Inline <img height = intHeight | %Height ... >
Script HtmlImage.Height [ = intHeight | %Height ]

Property Value


intHeight Integer specifying the height, in pixels.
%Height Value expressed as a percentage of the parent object's height.

The property is read/write with no default value.

Remarks

The Height and Width properties of an HtmlImage can be used two ways:

  • to send the image size specifications to the browser, or
  • to scale the image.

Height and Width give browsers an idea of the size of an image so that they may reserve space for it and continue rendering the document while waiting for the image data. This displays the Web page faster since the browser does not need to recalculate the positions of other elements on the page as the image loads.

When using values that are different from the natural size of the image, the browser overrides the physical image size in favor of these values and the image is resized accordingly. This method for scaling an image is not recommended, though, as it takes longer for the page to display. Instead, physically resize the image in a graphics editor to the size you need.

By default, Height is expressed in pixels, but can also be expressed as a percentage of the containing object, which typically is the page. Heights expressed as percentages are based on the vertical space currently available, not on the natural size of the image. Note, though, that this property always retrieves the height in pixels.

Example

The below code shows how to declaratively set the Height property of an HtmlImage control at design time.

<img src="~/shared/aspxtreme.jpg" width=100 height=30 border=0 
   alt="Simply awesome" align="right" runat="server" />
See Also

HtmlImage Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph