ResizeObserverSize.blockSize
The blockSize
read-only property of the ResizeObserverSize
interface returns the length of the observed element's border box in the block dimension. For boxes with a horizontal writing-mode
, this is the vertical dimension, or height; if the writing-mode is vertical, this is the horizontal dimension, or width.
Note: For more explanation of writing modes and block and inline dimensions, read Handling different text directions.
Syntax
var blockSize = ResizeObserverSize.blockSize;
Value
A decimal representing the block size in pixels.
Examples
In this example we return an array of sizing information with ResizeObserverEntry.contentBoxSize
. The blockSize
property returns the block dimension size of the observed element.
const resizeObserver = new ResizeObserver(entries => { for (let entry of entries) { let elemSize = entry.contentBoxSize[0]; console.log(elemSize.blockSize); // a decimal } }); resizeObserver.observe(divElem);
Specifications
Specification |
---|
Resize Observer # dom-resizeobserversize-blocksize |
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
blockSize |
84 |
84 |
69 |
No |
Yes |
No |
84 |
84 |
79 |
Yes |
No |
14.0 |
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserverSize/blockSize