Microsoft HomeproductssearchsupportshopWrite Us   Microsoft Home
Magazine
 |  Community
 |  Workshop
 |  Tools & Samples
 |  Training
 |  Site Info

Workshop  |  DHTML, HTML & CSS

height Attribute | height Property


Sets or retrieves the height of the object.

Syntax

HTML{ height: "auto" | length | percentage }
Scriptingobject.style.height [ = sHeight]

Possible Values

autoDefault height.
lengthFloating-point number and an absolute units designator (cm, mm, in, pt, pc, or px) or a relative units designator (em or ex).
percentageValue expressed as a percentage of the parent object's height.
The property is read/write with a default value of auto; the CSS attribute is not inherited.

Remarks

The height of a block object encompasses border-top, border-bottom, padding-top, padding-bottom, margin-top, margin-bottom, and height—the sum of which equals the height of the parent's content.

Percentage values refer to the parent object's height. Negative values are not allowed.

To carry out operations on the numeric value of this property, use pixelHeight or posHeight.

For more information on how to access the dimension and location of objects on the page through the document object model, see Measuring Element Dimension and Location.

Example

The following examples demonstrate use of both the height attribute and the height property to change the height of the object.

The sample below uses an inline style sheet to set an image's height to 4 centimeters.

Sample Code

<IMG SRC="sphere.jpeg" STYLE="height:4cm">

This feature requires Internet Explorer 4.0 or later. Click the icon below to install the latest version. Then reload this page to view the sample.
Microsoft Internet Explorer

The sample below uses inline scripting to change the image's height on an onclick event.

<BUTTON onclick="height1.style.height='1cm'">Shrink sphere</BUTTON>

This feature requires Internet Explorer 4.0 or later. Click the icon below to install the latest version. Then reload this page to view the sample.
Microsoft Internet Explorer

Applies To


Does this content meet your programming needs? Write us!

Back to topBack to top

© 1998 Microsoft Corporation. All rights reserved. Terms of use.

 

Magazine Home
Ask Jane
DHTML Dude
Extreme XML
For Starters
More or Hess
Servin' It Up
Site Lights
Web Men Talking
Member Community Home
Benefits: Freebies & Discounts
Benefits: Promote Your Site
Benefits: Connect with Your Peers
Benefits at a Glance
Online Special-Interest Groups
Your Membership
SBN Stores
Join Now
Workshop Home
Essentials
Content & Component Delivery
Component Development
Data Access & Databases
Design
DHTML, HTML & CSS
Extensible Markup Language (XML)
Languages & Development Tools
Messaging & Collaboration
Networking, Protocols & Data Formats
Reusing Browser Technology
Security & Cryptography
Server Technologies
Streaming & Interactive Media
Web Content Management
Workshop Index
Tools & Samples Home
Tools
Samples, Headers, Libs
Images
Sounds
Style Sheets
Web Fonts
Training Home
SBN Live Seminars
SBN Live Chats
Courses
Peer Support
CD-ROM Training
Books & Training Kits
Certification
SBN Home
New to SBN?
What's New on SBN
Site Map
Site Search
Glossary
Write Us
About This Site