Questa traduzione è incompleta. Collabora alla traduzione di questo articolo dall’originale in lingua inglese.

La proprietà a sola lettura HTMLElement.offsetWidth restituisce la larghezza del layout di un elemento. In genere, l'offsetWidth di un elemento è la misura che include i bordi degli elementi, l'elemento di riempimento orizzontale, l'elemento scrollbar verticale (se presente) e l'elemento CSS "width".

Syntax

var offsetWidth =element.offsetWidth;

offsetWidth is a read-only property.

This property will round the value to an integer. If you need a fractional value, use element.getBoundingClientRect().

 

Example

 

             Image:Dimensions-offset.png

Specification

Specification Status Comment
CSS Object Model (CSSOM) View Module
The definition of 'offsetWidth' in that specification.
Working Draft  

Notes

offsetWidth is a property of the DHTML object model which was first introduced by MSIE. It is sometimes referred to as an element's physical/graphical dimensions, or an element's border-box width.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
offsetWidth
Experimental
Chrome Full support 47Edge Full support 12Firefox Full support 1IE Full support YesOpera ? Safari Full support 11WebView Android Full support 47Chrome Android Full support 47Edge Mobile Full support YesFirefox Android Full support 4Opera Android ? Safari iOS ? Samsung Internet Android ?

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.

See also

 

Tag del documento e collaboratori

Hanno collaborato alla realizzazione di questa pagina: mdnwebdocs-bot, SphinxKnight, kerby58
Ultima modifica di: mdnwebdocs-bot,