MDN may have intermittent access issues April 18 13:00 - April 19 01:00 UTC. See whistlepig.mozilla.org for all notifications.

mozilla
Your Search Results

    HTMLElement.offsetWidth

    The HTMLElement.offsetWidth read-only property returns the layout width of an element. Typically, an element's offsetWidth is a measurement which includes the element borders, the element horizontal padding, the element vertical scrollbar (if present, if rendered) and the element CSS width.

    Syntax

    var offsetWidth =
    element.offsetWidth;
    

    offsetWidth is a read-only property.

     

    Example

    padding-top

    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

    Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

    padding-bottom

    Left Top Right Bottom margin-top margin-bottom border-top border-bottom

    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.

    See also

     

    Document Tags and Contributors

    Last updated by: fvsch,
    Hide Sidebar