CSS block-size Property


Example

Set the size of a <div> element in the block direction:

div {
  block-size: 200px;
}
Try it Yourself »

More "Try it Yourself" examples below.


Definition and Usage

The block-size property specifies the size of an element in the block direction.

Note: The related CSS property writing-mode defines block direction, and this affects the result of the block-size property. For pages in English, block direction is downward and inline direction is left to right.

The CSS block-size and inline-size properties are very similar to CSS properties width and height, but the block-size and inline-size properties are dependent on block and inline directions.

Show demo ❯

Default value: auto
Inherited: no
Animatable: yes. Read about animatable Try it
Version: CSS3
JavaScript syntax: object.style.blockSize="100px" Try it

Browser Support

The numbers in the table specify the first browser version that fully supports the property.

Property
block-size 57.0 79.0 41.0 12.1 44.0


CSS Syntax

inset-block: auto|value|initial|inherit;

Property Values

Value Description Demo
auto Default. The element's default block-size value. Demo ❯
length Specifies block-size in px, pt, cm, etc. Read about length units Demo ❯
% Specifies block-size in percent relative to size of parent element on the corresponding axis. Demo ❯
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit

More Examples

Example

With the writing-mode property value of a <div> element set to 'vertical-rl', block direction is moved from downwards to sideways, and this changes the direction the block-size property works in:

div {
  block-size: 250px;
  writing-mode: vertical-rl;
}
Try it Yourself »

Related Pages

CSS tutorial: CSS Height and Width

CSS tutorial: CSS Box model

CSS reference: height property

CSS reference: width property

CSS reference: writing-mode property


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.